nam797 Posted December 22, 2008 Share Posted December 22, 2008 Hello All, I am having a problem with a select statement. I am joining 3 tables and it is not showing correctly. I know it has something to do with my select statement. Here it is SELECT VendCrews.CrewID, VendCrews.Company, VendCrews.Fax, VendCrews.City, VendCrews.Inactive, tblTrades.Trade, VendCrewCnts.Name FROM (VendCrews INNER JOIN VendCrewCnts ON VendCrews.CrewID = VendCrewCnts.CrewID) INNER JOIN (VendCrewsTrades INNER JOIN tblTrades ON VendCrewsTrades.TradeID = tblTrades.TradeID) ON VendCrews.CrewID = VendCrewsTrades.CrewID WHERE VendCrews.Inactive = 'Active' Group BY Company ORDER BY Company Row Example 79 [/td] [td] A-1 Sheet Metal & Roofing, Inc. NULL NULL Active Roofing John Deleski Where it shows roofing there might be more than one(Roofing,siding,decks) that this subcontractor might do. Thanks for the help Link to comment https://forums.phpfreaks.com/topic/138057-help-with-a-select/ Share on other sites More sharing options...
fenway Posted December 22, 2008 Share Posted December 22, 2008 You can't use GROUP BY and get back multiple columns. Link to comment https://forums.phpfreaks.com/topic/138057-help-with-a-select/#findComment-721612 Share on other sites More sharing options...
nam797 Posted December 22, 2008 Author Share Posted December 22, 2008 If i use DISTINCT i get the same results Link to comment https://forums.phpfreaks.com/topic/138057-help-with-a-select/#findComment-721625 Share on other sites More sharing options...
fenway Posted December 22, 2008 Share Posted December 22, 2008 If i use DISTINCT i get the same results Of course you do... I didn't say anything about distinct. Link to comment https://forums.phpfreaks.com/topic/138057-help-with-a-select/#findComment-721647 Share on other sites More sharing options...
nam797 Posted December 22, 2008 Author Share Posted December 22, 2008 Could you point me in the right direction on solving this? Link to comment https://forums.phpfreaks.com/topic/138057-help-with-a-select/#findComment-721652 Share on other sites More sharing options...
fenway Posted December 22, 2008 Share Posted December 22, 2008 Could you point me in the right direction on solving this? Sure... let's take it from the top... what are you trying to display, and why do you have the group by? Link to comment https://forums.phpfreaks.com/topic/138057-help-with-a-select/#findComment-721657 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.