468,242 Members | 1,496 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

SQL Query to display count of two columns from different tables

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
0 2260

Post your reply

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

Similar topics

10 posts views Thread by Thomas R. Hummel | last post: by
3 posts views Thread by Pakku | last post: by
1 post views Thread by sunilkeswani | last post: by
5 posts views Thread by Sam | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.