for the second one you can do a subquery:
select specific_p from <your table> where specific_p like '%68030% and
specific_p in (select distinct specific_p from <your table>);
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
'%68030%'.
this may not be exactly what you want, but you can play with it a bit.
if you think tables, SQL really makes sense.
-lucas
On Wed, 31 Jan 2001, Miles Thompson wrote:
> 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 %68030% limit 1
> or maybe it's TOP 1. Can't remember. Check your Sql Server docs.
>
> Miles
>
> At 08:28 AM 1/31/01 -0600, Robert wrote:
> >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 9843 12
> >68030rc50 9843 50
> >
> >I want to show the 68030, but not the comment. I also don't want to show
> >three seperate 68030s and pick one that is not 0 qty if there is one.
> >Is there an MSSQL command to only get one of them?
> >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 them.
> >
> >I could probably write a filter, but WHY if it is built into SQL?
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]