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 |
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2005-10-27 : 09:54:06
|
| i have a main table with users with there each unique id fo exampe like passport number.now i have 3 other tables in which each table hold for the unique userfew rows with details!in table a : there are 3 rowsin table b : there are 8 rowsin table c : there are 0 rowsi want to make a select which give me few field from the main tableand the count(table a),count(table b),count(table c)how can i do this?beaucse i tried to do it with inner join and i got on all 3 count if based on the about data the value 8!!!!why is that?thnaks i nadvancepelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-10-27 : 10:04:08
|
| The Count will display the total number of number of records which your select query produced.Complicated things can be done by simple thinking |
 |
|
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2005-10-27 : 10:12:26
|
| can u help o not?Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-10-27 : 11:03:30
|
use left join instead of inner join.use northwindselect count(distinct o.orderid), count(od.orderid)from orders O left join [Order details] OD on O.orderid = OD.orderId Go with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|