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

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
blokdijk
Posts: 2
Joined: Tue Mar 12, 2019 7:44 am

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

Post by blokdijk » Tue Mar 12, 2019 7:49 am

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"

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

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

Post by AxWald » Tue Mar 12, 2019 12:47 pm

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
;-)
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

blokdijk
Posts: 2
Joined: Tue Mar 12, 2019 7:44 am

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

Post by blokdijk » Tue Mar 12, 2019 9:56 pm

Exactly what I needed, thanks so much...time to learn MYSQL :D

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”