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...

SQL Syntax is

SELECT *
FROM TABLE
WHERE COLUMN1 = 'VALUE1' AND COLUMN2='' ....

It will be better if post the error text here

hi...

you can use code like this

SELECT * FROM `book` WHERE bname='Computer Fundamentals' and author='Shekhar G' and quantity='4' and category='Computer'

hey guys...

i figured out my mistake...

the code i was using was :

Select * from tablename where col1= value1 AND col2 ==value2

I guess the habit of using C caused the error. Anyways, tracing errors of this sort is extremely difficult, and the only way to avoid them is to have suffered bcoz of them once...

a big thx to all those who replied...

thx guys...

cheers...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.