PDA

View Full Version : SQL - LIKE function pull many item



apple
08-03-2007, 09:20 PM
Hi all,

Can anyone let me know how to pull many item use LIKE % function?
Please refer my attachment. Thanks

mattj
08-06-2007, 08:08 AM
Use the AND and OR comparison operators:

Like blah AND Like blahblah OR Like Blahblahblah

HTH
Matt

apple
08-06-2007, 08:27 AM
Hi,

Could you please explain, i not understand. Thanks

mattj
08-06-2007, 08:29 AM
Example:

SELECT "*" FROM Table WHERE Table.Column1 = 1 OR Table.Column1 = 2

SELECT "*" FROM Table WHERE Table.Column1 = 1 AND Table.Column2 = 2

apple
08-06-2007, 08:41 AM
Hi,

If i put "OR" , "AND" is it LIKE function can pull 2 or more number than that, at the same time. As i know "LIKE only can pull 1 number right?

For example:

SELECT*
FROM TABLE1
WHERE COLUMNA LIKE '%A%' or '%B%'

Is it the example correct if i want to pull 2 item number at the same time

mattj
08-06-2007, 08:44 AM
I really don't understand your question, so here are some more examples:
SELECT "*" FROM Table WHERE Table.Column1 Like 1 OR Table.Column1 Like 2

SELECT "*" FROM Table WHERE Table.Column1 Like 1 AND Table.Column2 Like 2

apple
08-06-2007, 08:56 AM
Thanks for your help