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 Link to comment https://forums.phpfreaks.com/topic/113288-sql-syntax-how-to-limit-unique/ 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 Link to comment https://forums.phpfreaks.com/topic/113288-sql-syntax-how-to-limit-unique/#findComment-582046 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 Link to comment https://forums.phpfreaks.com/topic/113288-sql-syntax-how-to-limit-unique/#findComment-582047 Share on other sites More sharing options...
PC Nerd Posted July 5, 2008 Author Share Posted July 5, 2008 bump Link to comment https://forums.phpfreaks.com/topic/113288-sql-syntax-how-to-limit-unique/#findComment-582576 Share on other sites More sharing options...
AndyB Posted July 5, 2008 Share Posted July 5, 2008 SELECT DISTINCT Area WHERE Item_id = '$ItemID' Link to comment https://forums.phpfreaks.com/topic/113288-sql-syntax-how-to-limit-unique/#findComment-582578 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 Link to comment https://forums.phpfreaks.com/topic/113288-sql-syntax-how-to-limit-unique/#findComment-582582 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.