|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Select query for fetching records from two tables
Hi
I have created two tables which are movies table and videos table Columns of movies table are movie id, movietitle, moviereviewid and the select statement which I have written to fetch count of reviews is as follows select movieid, count(moviereviewid) as Moviereviewscnt from movies where moviereviewid >0 columns of videos table are videoid, videoname and movievideoid and the select statment which I have written to fetch count of videos is as follows select movieid, count(videoid) as Vidoescnt from videos where videoid >0 I want to write a select query to fetch all those movies which has got moviereviews and movievideos in a single table i.e. it should have movieid, moviename, moviereviewscnt and movievideoscnt In other words it should show only those movies which has reviews and videos which is >0 |
|
#2
|
||||
|
||||
|
Hey,
You don't list movieID as a column in the Video table, but you have it in your query. Does the Video table have movieID as a column? If not is there anything that is common between the two tables. In other words what field lets you know that a video is for a particular movie?
__________________
P.S. I am looking for work. <grin>. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Select query for fetching records from two tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|