[PHP-DB] what does % mean?

2003-01-31 Thread Mignon Hunter
Hello list,

I am trying to decipher some code written by someone else.  In it there
is a query:

$query = select description from $prodtable where description like '%'
or type like '%' group by description;

I've seen it used as mathematical modulos, but not sure how it's used
here.  

Thx

-- 
Mignon 



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




Re: [PHP-DB] what does % mean?

2003-01-31 Thread John Krewson
It's a wildcard

Example:  I'm looking for the value A1 in a column that has values
A1-1, A1-2, A1-3

select count(*) from table where column like '%A1%'
will give me a count of three


Mignon Hunter wrote:

Hello list,

I am trying to decipher some code written by someone else.  In it there
is a query:

$query = select description from $prodtable where description like '%'
or type like '%' group by description;

I've seen it used as mathematical modulos, but not sure how it's used
here.  

Thx


--
John Krewson
Programmer - SWORPS


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




Re: [PHP-DB] what does % mean?

2003-01-31 Thread 1LT John W. Holmes
 I am trying to decipher some code written by someone else.  In it there
 is a query:

 $query = select description from $prodtable where description like '%'
 or type like '%' group by description;

 I've seen it used as mathematical modulos, but not sure how it's used
 here.

It is a wildcard, like someone else said.

That exact query has a poor syntax, though.. .unless there's a method behind
the madness. Since it's matching a wildcard only.. which would match
everything, you could use select description from $prodtable group by
description and get the same results.

---John Holmes...


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