PC Nerd Posted July 5, 2008 Share Posted July 5, 2008 Hi, Ive got a table of only 4 fields - but within a month will contain hundreds or thousands of records etc. My Fields: `Location_ID`, `Item_ID`, `Area`, `Location` the reason that there will be so many fields in such a short period of time, is that for every item there can be 10 or so areas, and for every area, there can be 10 or so Locations ( think of it as listing cities, and locations in cities) I want to be able to simply gather a list of areas unique to that item. ie - ignore the Location and only use the Areas per ITem: "SELECT `Item_ID`, `Area_ID` FROM `item_loc` WHERE `Item_ID` = '".$ItemID."' WHERE... <condition>" ????? I dont know what to do with the condition. Thanks for your help in advace Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted July 5, 2008 Share Posted July 5, 2008 WHERE item=$itemid AND whatever=$whatever AND blah=$blah Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted July 5, 2008 Author Share Posted July 5, 2008 I know how to do conditions etc ive been workign with them non stop for 3 days my questions is what should my cindition ( or SQL function etc) be to ensure that it completely ignores locations, and simply lists teh areas etc? Thanks Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted July 5, 2008 Author Share Posted July 5, 2008 bump Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 5, 2008 Share Posted July 5, 2008 SELECT DISTINCT Area WHERE Item_id = '$ItemID' Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted July 6, 2008 Author Share Posted July 6, 2008 so: SELECT <fields> DISTINCT Area_ID WHERE Item_ID = $Item_ID ?? :> - thankyou Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.