Jump to content


Photo

How do I select all records where something starts with an A


  • Please log in to reply
2 replies to this topic

#1 Dark Lord

Dark Lord
  • Members
  • Pip
  • Newbie
  • 1 posts

Posted 14 October 2003 - 01:02 PM

I got as far as:
Select * from `Persons` WHERE `vn` LIKE \'$vn\'

but that only selects the ones that are equal to $vn and not the ones starting with $vn... how do i get it to select the ones starting with $vn???
Darkness has come ...[br]I can feel it ...[br]It is very close ...[br]Damn now i know why ...[br]It's ME :P :P

#2 Kriek

Kriek
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationFlorida

Posted 14 October 2003 - 02:01 PM

Use the wildcard % characters.

SELECT * FROM Persons WHERE vn LIKE \'%$vn%\';

Jon Kriek ยท PHP Freaks
Sometimes the need to mess with their heads ...
... outweighs the millstone of humiliation.


#3 michael yare

michael yare
  • Members
  • PipPip
  • Member
  • 25 posts
  • LocationLondon, UK

Posted 20 October 2003 - 03:26 PM

If he does that Jon, he will get everything with $vn in - starting, middle or ending.

He wants:

LIKE \'$vn%\'





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users