Page 1 of 1

search in mysql column 3 when found, return contents of column1 only

Posted: Tue Mar 12, 2019 7:49 am
by blokdijk
Hi, I have the code below which returns all columns in mysql. How can I get it to work that it searches only in COL 3 and if found returns the content of COL 1 only?

thank you!

put "SELECT * FROM `TABLE 1` WHERE `COL 3` LIKE '%"&zoekopdit&"%'" into tSQL

put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tData

put tData into field "Data"

Re: search in mysql column 3 when found, return contents of column1 only

Posted: Tue Mar 12, 2019 12:47 pm
by AxWald
Hi,

if you don't want the whole record (*) but only a field (COL 1), just ask accordingly:

Code: Select all

put "SELECT `COL 1` FROM `TABLE 1` WHERE `COL 3` LIKE '%" & zoekopdit & "%'" into tSQL
;-)

Re: search in mysql column 3 when found, return contents of column1 only

Posted: Tue Mar 12, 2019 9:56 pm
by blokdijk
Exactly what I needed, thanks so much...time to learn MYSQL :D