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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 query problem

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-03-28 : 07:13:24
harish maheshwari writes "Hello.
Suppose there is a two tables named A & B .
Fields of A are like this : userId, age
Fields of B are like this : userId, address
now i want to display all those user's addresses who have the age below 21.
plz guide me...
Harish"

samsekar
Constraint Violating Yak Guru

437 Posts

Posted - 2003-03-28 : 08:05:55
TRY THIS:
SELECT A.USERID,A.AGE,B.ADDRESS FROM A, B
WHERE A.USERID=B.USERID AND A.AGE<21

Sekar
~~~~
Success is not a destination that you ever reach. Success is the quality of your journey.

Edited by - samsekar on 03/28/2003 08:06:39
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-03-28 : 08:18:57
Sekar's join syntax will not be supported in versions of SQL Server moving foward. You should be using the ANSI style joins.

select
a.userid,
a.age,
b.address
from
a
inner join b
on a.userid = b.userid
where
a.age < 21

 


Jay White
{0}
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-03-28 : 08:20:34
quote:

Sekar's join syntax will not be supported in versions of SQL Server moving foward. You should be using the ANSI style joins.




That's probably the answer to his NEXT homework question ....

- Jeff
Go to Top of Page

samsekar
Constraint Violating Yak Guru

437 Posts

Posted - 2003-03-28 : 08:42:21
quote:

Sekar's join syntax will not be supported in versions of SQL Server moving foward. You should be using the ANSI style joins.



Thanks Jay. I will not do that again.


Sekar
~~~~
Success is not a destination that you ever reach. Success is the quality of your journey.
Go to Top of Page

LarsG
Constraint Violating Yak Guru

284 Posts

Posted - 2003-04-06 : 14:39:24
The syntax used by samsekar is ANSI compliant, so that is not a reason for not using it. What microsoft has stated is that their propriatary syntax for outer join, e.g.

where a =* b

will become obsolete. This misunderstanding seems to be all to common.

Go to Top of Page
   

- Advertisement -