1.11M Members

Baffled with SELECT LIKE / IN

 
0
 

Good Morning,

Hopefully someone can help me with a quick answer.

I have a transaction table with a 'description' column that contains a combination of the members name and some static information i.e. "'username' PURCHASE" or "'username' PAYMENT"

and a 'type' column that contains various types of transactions i.e. 'FEE' or 'EARN'

I have a list of usernames, and I need to get the transaction number from each of these records where the 'description' contains a username from the list and the 'type' ='FEE'.

I don't know how to use the LIKE with the % wildcard along with the IN (using a list)

Any help would be greatly appreciated.

Douglas

 
1
 

not 100% on what you're looking at (seeing the table structure would help) .. explain TABLENAME or show create table TABLEANME.

but here goes...

SELECT [COLUMNS_NAMES] FROM [TABLENAME] WHERE DESCRIPTION LIKE "%searchterm%" AND type  IN ('FEE', 'EARN')

hope this helps. cheers.

Also, Mysql has a great refernece on their website ..
http://dev.mysql.com/doc/refman/5.0/en//string-comparison-functions.html#operator_like

 
0
 

select * from table
where DESCRIPTION LIKE "%searchterm1%" or
DESCRIPTION LIKE "%searchterm2%" or
DESCRIPTION LIKE "%searchterm3%" or
DESCRIPTION LIKE "%searchterm4%"

 
0
 

Thank you both for your responses...

Sorry for the long delay, but I got sidetracked again and emursed in another project.

On this question, I concluded it wasn't worth the time or struggle to find a cure for it, because it would be a one time use and the total number of records effected was under 100, so I just went through them one by one manually and made the necessary adjustments.

Thanks again for the responses, but I'm going to mark this as solved .

Question Answered as of 1 Year Ago by urtrivedi and loud_noises
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article