Click here to Skip to main content
12,453,873 members (62,115 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# SQL-Server
Hello
I have a query in sql server 2008

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

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 17-Nov-12 23:44pm
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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

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[^]
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 18 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100