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)
 What is the error in this query

Author  Topic 

satish.gorijala
Posting Yak Master

182 Posts

Posted - 2009-05-22 : 07:16:30
Can any help me to figure out the error in below query.

SELECT TBL_LastName.Continent, TBL_LastName.Culture,
TBL_LastName.Religion,
TBL_LastName.Name = case when TBL_LastName.Name is null
then 'not found'
else TBL_LastName.Name
end
FROM TBL_LastName INNER JOIN
TBL_NameBreakdown ON TBL_LastName.Name = TBL_NameBreakdown.Name Order by TBL_LastName.Name

I am getting error at line-3 as "Incorrect syntax near '='."

G. Satish

vision99
Starting Member

14 Posts

Posted - 2009-05-22 : 07:43:35
Try following select statment.......

SELECT
TBL_LastName.Continent,
TBL_LastName.Culture,
TBL_LastName.Religion,
case when TBL_LastName.Name is null
then 'not found'
else TBL_LastName.Name
end
FROM TBL_LastName INNER JOIN
TBL_NameBreakdown ON TBL_LastName.Name = TBL_NameBreakdown.Name Order by TBL_LastName.Name




-Vision
Go to Top of Page

satish.gorijala
Posting Yak Master

182 Posts

Posted - 2009-05-22 : 07:55:15
yes, perfect. thank you
quote:
Originally posted by vision99

Try following select statment.......

SELECT
TBL_LastName.Continent,
TBL_LastName.Culture,
TBL_LastName.Religion,
case when TBL_LastName.Name is null
then 'not found'
else TBL_LastName.Name
end
FROM TBL_LastName INNER JOIN
TBL_NameBreakdown ON TBL_LastName.Name = TBL_NameBreakdown.Name Order by TBL_LastName.Name




-Vision



G. Satish
Go to Top of Page
   

- Advertisement -