bluebyyou Posted October 2, 2008 Share Posted October 2, 2008 Lets say I have a table with two fields, name and type. Every item in name is unique. There are 3 types like animal, vegetable, mineral. Like this: Name | Type ----------------- blah | animal foo | vetable bar | mineral baz | animal foobar | animal I want to run a query where the output gives me just the main types, but not every row. Does anyone know what I am trying to say? Quote Link to comment https://forums.phpfreaks.com/topic/126724-solved-groups-of-items/ Share on other sites More sharing options...
JasonLewis Posted October 2, 2008 Share Posted October 2, 2008 So you want to GROUP BY type? Quote Link to comment https://forums.phpfreaks.com/topic/126724-solved-groups-of-items/#findComment-655566 Share on other sites More sharing options...
GregL83 Posted October 2, 2008 Share Posted October 2, 2008 You want to use the Distinct mysql setting... http://www.w3schools.com/sql/sql_distinct.asp Quote Link to comment https://forums.phpfreaks.com/topic/126724-solved-groups-of-items/#findComment-655644 Share on other sites More sharing options...
bluebyyou Posted October 2, 2008 Author Share Posted October 2, 2008 Thanks GregL83, exactly what I needed! Quote Link to comment https://forums.phpfreaks.com/topic/126724-solved-groups-of-items/#findComment-655874 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.