Click here to Skip to main content
15,916,019 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need an sql query to get all the column values to be displayed if any one condition is satisfied from multiple conditions? Is this can be possible..please help me...

if i use or condition i get all the records from the table if both exist..i want all the records if any condition matches with the table data..for example, if i have 2 columns a,b.. a has records say 1,2,3 and b has records 4,5,6 .now i want to retrieve all columns values of a,b when the condition matches a =1 or any other condition.

In ssrs i want to generate reports on any 1 condition is satisfied...I have textboxes of the fields in the database..and if the user enters the name if should get all the records corresponding to the name ..or if he enters id which is provided in another field he shd retreive all the corresponding results..the report contains many textboxes in which if the user inserts any one value in any corresponding textbox it shd display all the records in the report.
Posted
Updated 28-Sep-11 3:37am
v2
Comments
André Kraak 28-Sep-11 9:12am    
Please share any relevant code with us, seeing the code might us help understand the problem you are facing.

If you wish to change your question use the Improve Question button.

1 solution

OR is what you want to use.

Have a look at the explanation of the search condition[^].

So use a OR in your WHERE clause like:
SQL
SELECT .... WHERE a = 1 OR b = 2
 
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