|
From: Danny on 7 May 2008 09:00 Hi all, So I have these tables of items and item-types, and the items can be of several types: Items: ID ; Name 1 ; Item1 2 ; Item2 ItemType: ID ; Type 100 ; Type1 200 ; Type2 300 ; Type3 Now, to link these 2 I have a "linking" table: LinkingTable: ItemID ; ItemTypeID 1 ; 100 1 ; 200 2 ; 100 2 ; 300 Now I want to select all the items of type 100 or 200... How can I do that without getting a duplicate row of item 1?? Thanks in advance, Danny
From: Plamen Ratchev on 7 May 2008 10:17 You can use DISTINCT: SELECT DISTINCT I.item_id, I.item_name FROM Items AS I JOIN ItemTypes AS T ON I.item_id = T.item_id WHERE T.item_type_id IN (100, 200); HTH, Plamen Ratchev http://www.SQLStudio.com
|
Pages: 1 Prev: Prevent Excel and Access access to SQL 2000 Next: Stored Procedures and Commiting Data |