xxreenaxx1 Posted February 22, 2011 Share Posted February 22, 2011 I have created a query in order for sub_name to be displayed but I need to show all the field and DISTINCT only Sub_Name field. Is that possible? If Yes, How? $query=("SELECT DISTINCT * FROM User u, Subject s, Test t WHERE u.Use_ID = 3 AND s.Sub_ID=t.Sub_ID Quote Link to comment https://forums.phpfreaks.com/topic/228478-having-trouble-with-distinct-query/ Share on other sites More sharing options...
kickstart Posted February 22, 2011 Share Posted February 22, 2011 Hi I presume that sub_name is shared between several rows. As such how do you want to determine which of the other rows is returned with the distinct sub_name. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/228478-having-trouble-with-distinct-query/#findComment-1178110 Share on other sites More sharing options...
Muddy_Funster Posted February 22, 2011 Share Posted February 22, 2011 What is it with people using SELECT * and single letter aliases for tables that are only 4 letters long anyway? Just to be lazy? That asside, sounds like your looking to use GROUP BY more than SELECT DISTINCT, but we're going to need some more information to be of any real help. Quote Link to comment https://forums.phpfreaks.com/topic/228478-having-trouble-with-distinct-query/#findComment-1178113 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.