By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,842 Members | 2,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,842 IT Pros & Developers. It's quick & easy.

SQL Query to display count of two columns from different tables

P: 17
Hi

Thank you for your response. Query doesnt give the expected result.

Here is the sample data :

Foodid blogcid
3 12356
3 12357
3 12358
9 15265
15 18963
15 18964
19 0
13 22156

Videoid Videotitle Destid

9 paneerpakora 3
10 paneerpakora 3
11 aloogobhi 9
16 chinese chickensalad 15
17 chinese chickensalad 15
18 chinese chickensalad 15
45 Chicken 19
0 tomato soup 13


Here is the expected result:

Output should display as given

Food id blogcnt Videocnt
3 3 2
9 1 1
15 2 3
13 1 1

On executing the query it should display only those records for which blogs and videos are existing. It should not dipslay the records if there are no videos or if there are no blogs posted. In other words it should fetch only those records for which videos and blogs are posted, displaying the count of blogs and count of videos as given above.
Sep 18 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.