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

SQL Select Query to fetch Count of two columns from two different tables

P: 17

Thanks for your response but the query which you gave in my previous post doesnt work. It displays the same cnt for movie reviews and videoreviews

Let me explain you in detail

As I said I have got two tables like one is 'Food table' and the other one is the 'Videos' table

Columns which I have created in 'Food' table are 'foodid' and 'blogcid'
colcumns which I have created in Videos table are 'videoid, 'destid', 'videotitle'

Common column for the above two tables are foodid and destid which has the same content id for inner join

I need to fetch records of those foodids which has got blogs and videos

For example

Food id blog cid
3 12356
9 15265
15 18963
19 0
13 22156

videoid videotitle destid
9 paneerpakora 3
11 aloogobhi 9
16 chinese chickensalad 15
45 Chicken 19
0 tomato soup 13

From the above data I have to fetch only those records which has blogs and videos. In other words I need a select query to fetch records of those dishes alone which has blogs >0 and destid >0 which means that fetched foodids should have both blogs and videos it should fetch records which doesnt have blogs or videos.
Sep 17 '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.