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 - 2006-03-07 : 09:14:46
|
i have few talesand i am making a select lik thisselect *,usersentrance.date1 from users left join usersdata on......left outer join usersentrance on users.id=usersdata.id......(and it continues with some more left outer join's) the thing is that in the usersentrance i have at least 20 rows for an id that i check,and in the selec above i recive 1 rows wih a datain which the usersentrance.date1 has a date (not the last entrance date but atnoher 1 form few months back!!!)how comes?how the sql server decided which id to take?thnaksi nadvancepelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2006-03-08 : 02:58:36
|
| i will start againi have 3 tables:users with userid,username,passusersdata with userid,name,last name,phone,cellolar an so on.....usersentrance with userid,ip,dattime,browser typemy select is like this[CODE]select * from users inner join usersdata onusers.userid=usersdata.userid[/CODE]this will bring me 1 row with all the data of 2 tablesthen i add[CODE]select * from users inner join usersdata onusers.userid=usersdata.useridleft outer join usersentrance onusers.userid=usersentrance.userid[/CODE]now 2 questins :1)why do i recive only 1 line, where in the usersentrance table i have say 20 lines for a given userid? (i thought i should recive 20 lies in which most of the data is the same except fir the data from the usersentrance table)?2)why or how th e sql server decide which from the 20 rows to bring?why not the first or last?thnaks in advancepelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
 |
|
|
|
|
|
|
|