Re: mysql wildcard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In a message dated 1/8/03 2:48:15 PM Pacific Standard
Time, epeloke@echoman.com writes:

<<I have an query:

select * from offtime where type='$type'

then I just pass the type variable to the page.  Is
there a wildcard in mysql like there is in sqlserver
that I can use to grab all the records? such as select
* from offtime where type='%' would grab all. >>

Yes, MySQL has a wild card. It is % for a string of
characters or _ for a single character. You can say
things like where type like 'tp%'. However, if all you
want to do is get all the records from a table, you can
do that with:

SELECT * FROM offtime

Wild cards are used more for things like:

SELECT * FROM offtime WHERE type LIKE 'tp%'

You can also do pattern matching with regular
expressions using REGEXP

Janet
------------------
Janet Valade
author, PHP and MySQL for Dummies

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux