What a nice example of TMTOWTDI - "There's more than one way to do it" -
the motto of the PERL contingent.

At 11:25 PM 5/17/02 -0500, you wrote:
>I did not understand the request - but the answer is still almost as
>simple. Simply
>do a subselect of the customers who meet the second criteria.
>
>select * from cust where item# = '12a' and cust# in (select cust# from
>transfile where
>   item# <> '13a')
>
>I don't have a system up to run that query on, so the syntax is probably
>not 100% correct,
>but it is close enough that a minute or two with the manual will give you
>the correct syntax.
>Be sure to do an explain on the thing though. There are actually at least
>two ways to do that,
>and probably more like three or four.
>
>
>-Paul
>
>
>----- Original Message -----
>From: "Vernon Hamberg" <vhamberg@attbi.com>
>To: <midrange-l@midrange.com>
>Sent: Friday, May 17, 2002 11:13 PM
>Subject: Re: Sql question
>
>
> > This'll give both 123 and 469 - he wants only 469
> >
> > At 08:58 PM 5/17/02 -0500, you wrote:
> > >SELECT CUST#, ITEM# from TRANSFILE WHERE ITEM# = '12a'
> > >
> > >
> > >----- Original Message -----
> > >From: "Smith, Mike" <Mike_Smith@RGCResources.com>
> > >To: <midrange_L@midrange.com>
> > >Sent: Friday, May 17, 2002 12:32 PM
> > >Subject: Sql question
> > >
> > >
> > > > This message is in MIME format. Since your mail reader does not
> understand
> > > > this format, some or all of this message may not be legible.
> > > > --
> > > > [ Picked text/plain from multipart/alternative ]
> > > > I have a file that has data like this
> > > >
> > > >  <file:Transfile> file:Transfile
> > > > Cust#           Item#
> > > > 123             '12a'
> > > > 123             '13a'
> > > > 469             '12a'
> > > > 550             '13a'
> > > >
> > > > I want to be able to select customers who have ordered item '12a' but
> > > > not '13a'
> > > >
> > > > So I would end up with
> > > >
> > > > 123 as the only record returned out of this data set.
> > > >
> > > > Can I do this with a SQL statement?
> > > >
> > > > Thanks
> > > >
> > > > Mike
> > > >



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.