1. Home >
  2. Apps >
  3. Groups >

Data slection based on multiple conditions

Question asked by hbk in #Coffee Room on Jul 2, 2008
hbk
hbk · Jul 2, 2008
Member of CrazyEngineers
hi frnds.

this is something which may seem foolish to ask, but i have been beating my head against the wall at the frustration of not being able to get over this...

anyways, what i want to do is to select some data from a single MySQl table, using a WHERE clause on multiple columns

eg. SELECT * from TABLENAME where COLUMN1 = VALUE1, COLUMN2 = VALUE2, COLUMN3 = VALUE3 ....

I have tried using (),AND as well as comma between the different conditions, but they all give an error.

please help...

cheers... Posted in: #Coffee Room
yudi
yudi · Jul 28, 2008
Member of CrazyEngineers
Re: data slection basd on multiple conditions

try using OR operator coz as per my knowledge
different conditions in where clause are seperated by OR operator......
esakiraja
esakiraja · Jul 28, 2008
Member of CrazyEngineers
Think this below eg will help u...

Eg: select * from tablename where primarykey(column) = 'value'
and column2 = 'value'
and column3 = 'value'
Itanium
Itanium · Aug 2, 2008
Member of CrazyEngineers
select * from table
where col1 = 'value1' and
col2 = 'value2' and
col3 = 'value3';

this should be the query if all the columns are holding string data.
If any column is holding numeric data, then you dont need to specify the value within quotes.

Can you post your exact code for us to analyse ?

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up