Click here to Skip to main content
16,013,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I have a query in sql server 2008

SQL
SELECT  r.[Name] FROM [Center] c
INNER JOIN SwitchType s ON c.[ID] = s.[ID]
RIGHT JOIN [ReportType] r ON c.[ID]= r.[ID]



its work good . but I add condition to my query its doesn't work . for example

SQL
SELECT  r.[Name] FROM [Center] c
INNER JOIN SwitchType s ON c.[ID] = s.[ID]
RIGHT JOIN [ReportType] r ON c.[ID]= r.[ID]
where c.[Name] = 'a'


why ? pleas help me .
Posted
Updated 17-Nov-12 23:45pm
v2
Comments
OriginalGriff 18-Nov-12 6:01am    
What do you mean by "it doesn't work" - try to explain what teh problem is. Does it select data you didn't intend? Select no data? Or throw an exception?

1 solution

may be it doesnt find any result where your center table name column = a
i think you need to use like.

SQL
SELECT  r.[Name] FROM [Center] c
INNER JOIN SwitchType s ON c.[ID] = s.[ID]
RIGHT JOIN [ReportType] r ON c.[ID]= r.[ID]
where c.[Name] like 'a%'


see more http://www.w3schools.com/sql/sql_like.asp[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900