Re: select query assistance
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 05 Apr 2005 22:46:31 +0200
On Tue, 5 Apr 2005 12:31:10 -0700, AshleyT wrote:
>Querying a table that has the line items for a ticket sold at a retail store.
> So I am looking for the tickets that only have CIGARETTE items on it. The
>ITEM table has columns:
>
>TICKET NUM (PK)
>TICKET_DATE (PK)
>LINE # (PK)
>ITEMDESC
>ITEM UPC
>ITEM DEPARTMENT (When equal to 2 then cigarette)
>
>So I want tickets that ONLY have cigarette items (all items on the tickets
>are cigarettes no matter the ITEM count.)
>
>Thanks for any help.
Hi Ashley,
SELECT (column list goes here)
FROM YourTable AS a
WHERE EXISTS (SELECT *
FROM YourTable AS b
WHERE b.Ticket_Num = a.Ticket_Num
AND b.Ticket_Date = a.Ticket_Date
AND b.Item_Dept = 2)
(untested)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
.
- Follow-Ups:
- Re: select query assistance
- From: AshleyT
- Re: select query assistance
- References:
- select query assistance
- From: AshleyT
- select query assistance
- Prev by Date: select query assistance
- Next by Date: Re: select query assistance
- Previous by thread: select query assistance
- Next by thread: Re: select query assistance
- Index(es):