Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 17th, 2008, 04:33 AM
padmaneha padmaneha is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 1 padmaneha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 13 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old October 3rd, 2008, 10:24 AM
dykebert's Avatar
dykebert dykebert is offline
Contributing User
Click here for more information. Click here for more information
 
Join Date: Apr 2008
Posts: 349 dykebert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 11 h 7 m 47 sec
Reputation Power: 1
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>.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Select query for fetching records from two tables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT