Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sasikumar
Starting Member
1 Post |
Posted - 2009-01-02 : 09:11:20
|
| consider that i have 3 tables.named as articles,information,details...i want to count the how many information present in table where articles.information_id = anynumber... but one condition count should return information table should have atleast one details .relations:articles has many informationinformation has many details... |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-02 : 09:16:09
|
| [code]select count(a.article_id)from articles ajoin information ion i.information_id=a.information_idwhere i.information_id=@yournumber[/code]where @yournumber is number passed. |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-02 : 11:06:54
|
| try this select count(article_id) from articles where information_id in (Select information_id from information ) and information_id = @givennumber |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-02 : 11:18:20
|
quote: Originally posted by bklr try this select count(article_id) from articles where information_id in (Select information_id from information ) and information_id = @givennumber
better to use exists rather than in |
 |
|
|
|
|
|