Mr Asker
Mr Asker

Reputation: 2380

Get name starts with particular substring

I am trying to get the name which startet with this substring ZOB. In my table I have stop name ZOB/Hauptbahnhof Bussteig 5 and I want to get it as result back.

With the query below the result is empty.

query:

Select stop_name from behaviour where stop_name like 'ABC' and mac = ? LIMIT 1

Upvotes: 1

Views: 39

Answers (1)

Mureinik
Mureinik

Reputation: 312259

You are missing a wildcard (%) in the like's argument:

SELECT stop_name 
FROM   behaviour 
WHERE  stop_name like 'ZOB%' AND mac = ? 
LIMIT  1

Upvotes: 4

Related Questions