debuitls Posted September 7, 2009 Share Posted September 7, 2009 Hi all, This is an extension of a thread below which ran yesterday! But I dont expect anyone to read through the 27 entries so just gonna summarise here and see if anyone with a fresh pair of eyes today can make any suggestions! Bascially I have two tables bid table and proposal table. I'm trying to print to screen all the proposals made by a particular user! The problem is that only those proposals that have bids made on them are printing to screen. So for example if four proposals are made by a user, I want all four to be printed, however if only two of them have bids on them then only those will be printed. I'm pretty sure its something to do with the group by statement as when I remove it, it seems to work fine, but I consequently lose the critical "count bids" info. Anyway here's the code. SELECT proposal . * , SYSDATE( ) , GROUP_CONCAT( bid.proposalid ) AS 'bids', TIME_FORMAT( TIMEDIFF( tomorrowtime, SYSDATE( ) ) , '%H hours, %i minutes' ) AS timeleft FROM proposal LEFT OUTER JOIN bid ON proposal.proposalid = bid.proposalid WHERE NOW( ) < proposal.tomorrowtime AND proposal.username = '$username' GROUP BY bid.proposalid If anyone can think of anything please let me know! Been struggling with this for a while! Link to comment https://forums.phpfreaks.com/topic/173416-problem-with-group-by-aspect-of-sql-statement/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.