Try SELECT DISTINCT a.CategoryName
FROM Table(A) a, Table(B) b
WHERE a.CategoryId = b.CategoryID
AND b.ItemID = 20

tom


----- Original Message -----
From: "Gary J. Groomer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 10, 2000 1:43 PM
Subject: Need Help With a Query


> I am having a problem pulling what I want from a couple of tables and any
> help would be greatly appreciated.  Find below a simple synopsis of the
two
> tables.
>
> Table(A)
> ---------
> CategoryName           CategoryID
> -----------                ------------
> CategoryName1            1
> CategoryName2            2
> CategoryName3            3
>
> Table(B)
> ---------
> CategoryID    ItemID
> ------------    --------
> 1                    20
> 2                    20
> 1                    20
> 3                    35
>
> CategoryID is the common key.  What I want to do is pull a list of
> CategoryNames from Table(A) where the ItemID in Table(B)  = 20.  I want
the
> CategoryName returned once.  Every way that I have tried it, I get the
> CategoryName repeated for each entry in Table(B).
>
> Query:
> SELECT a.CategoryName
> FROM Table(A) a, Table(B) b
> WHERE a.CategoryId = b.CategoryID
> AND b.ItemID = 20
>
> Results returned:                    Desired Results:
> ----------------                     -----------------
> CategoryName1                    CategoryName1
> CategoryName1                    CategoryName2
> CategoryName2
>
> Again, any help would be greatly appreciated.
>
> --------------------------------------------------------------------------
----
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
  • Need H... Gary J. Groomer
    • R... Tom Muck
      • ... Gary J. Groomer
    • C... Michael J. Sammut -- Four Eyes Productions -- think | plan | create
      • ... Chris Montgomery
        • ... Michael J. Sammut -- Four Eyes Productions -- think | plan | create
          • ... Michael Sheldon
            • ... Raymond K. Camden
    • R... Alex Puritche

Reply via email to