Re: [PHP-DB] SQL Newbie Database search question

2001-01-31 Thread Lucas Rockwell
for the second one you can do a subquery: select specific_p from where specific_p like '%68030% and specific_p in (select distinct specific_p from ); this finds all the distinct specific_p fields and then does a query on them -- that table (remember SQL ONLY returns tables) -- for the like '%68

Re: [PHP-DB] SQL Newbie Database search question

2001-01-31 Thread Miles Thompson
add DISTINCT to your query select distinct specific_p, qty from database where specific_p = 68030 and qty > 0 For you second requirement, get them all, and just use the first one ... can't remember exact syntax but something like select specific_p from database where specific_p like %6803

Re: [PHP-DB] SQL Newbie Database search question

2001-01-31 Thread Robert
I meant to say: There may be other parts that are close too I want to search for %68030% to get all of them but show only one of each different specific_p. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PRO

[PHP-DB] SQL Newbie Database search question

2001-01-31 Thread Robert
I have a database with several fields... I only want certain fields to show in my results Some of the searched fields have the same value example: searched field is specific_p specific_p comment qty 68030 9845 0 68030 9844 100 68030 9