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)
 Correct Term question

Author  Topic 

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-08-08 : 12:03:30
I just wrote a query, but I'm not sure what type" of query to call it.

In the LEFT JOIN statement, I use an AND statement.
If there was no AND, it would be a simle "LEFT JOIN" query.
With the "AND" statement, what would you call it? Is there any special name for it?


SELECT t.TestID, t.TestName, ut.UserTestID, @UserID as UserID
FROM Test t
LEFT JOIN UserTest ut ON ut.TestID = t.TestID AND ut.UserID = @UserID
WHERE ut.UserID = @UserID
OR ut.UserID IS NULL
ORDER BY t.TestName


BTW, this was a tough nut to crack until i figured out I could do the "AND" thing in the JOIN statement

Thanks!
Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-08-08 : 12:14:13
quote:
Is there any special name for it?

a SELECT query....



Naw, I think is still just a left join.

You don't even need the WHERE clause, do you?

Jay White
{0}
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-08-08 : 12:22:14
I think you are right about the WHERE statment.

I'll give it a shot.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page
   

- Advertisement -