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 2005 Forums
 Transact-SQL (2005)
 Inner join problem?

Author  Topic 

DaringDon
Starting Member

9 Posts

Posted - 2008-05-22 : 04:38:27
Hello all. I am really new to SQL and am having to trying and debug a SQL statement which isnt returning any data. The statement in question is:

SELECT		E.EntityID ,
LTRIM(N.NameText) AS NameText,
E.DateCreated,
CONVERT(CHAR(10),E.DateCreated,103) AS DateAdded,
SystemName,
T.Name AS EntityType

FROM Entities E
INNER JOIN Systems S
ON S.SystemID = E.SystemID
INNER JOIN EntityTypes T
ON T.EntityTypeID = E.EntityTypeID
INNER JOIN Names N
ON N.EntityID = E.EntityID


I know that all tables except the Names table contain data. Really what i want to know is that if the names table containts no data should i still be getting some sort of result set back?

Thanks for reading.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-05-22 : 04:40:24
No.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

DaringDon
Starting Member

9 Posts

Posted - 2008-05-22 : 04:46:48
Thanks dude
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2008-05-22 : 11:39:47
Read about all the join types in BOL. You can return data from the other tables even if Names is empty. Obviously INNER joins won't do it for you - hint, hint.

harsh - great reply. Precise and to the point!
Terry
Go to Top of Page
   

- Advertisement -