Re: Group By - Is there a way to set which rows values are used for the fields not in the Group By clause?

2005-04-19 Thread Rich Carr
Thank you so much Vivian! Your first solution was exactly what I was looking for! It works perfectly! Thanks so much! Richard Vivian Wang [EMAIL PROTECTED] wrote: create table temp select * from viewvisitor order by lastviewtime desc; select app, itemid, ownerid, visitorid,

Re: Group By - Is there a way to set which rows values are used for the fields not in the Group By clause?

2005-04-18 Thread Vivian Wang
create table temp select * from viewvisitor order by lastviewtime desc; select app, itemid, ownerid, visitorid, vusername,lastviewtime, sum(viewcount) AS totalcount, itemname from temp where ownerid = 2 GROUP BY concat( app, itemid ) ORDER BY totalcount; or if you only care about

Re: Group By - Is there a way to set which rows values are used for the fields not in the Group By clause?

2005-04-12 Thread Dan Bolser
I think the suggestion posted here... http://lists.mysql.com/mysql/182424 should get you going in the right direction. You really need to know what you are doing to know if it is giving you the correct answer or not. It would be cool if their was something like a GROUP_ROW(cols, expr) to do

Re: Group By - Is there a way to set which rows values are used for the fields not in the Group By clause?

2005-04-12 Thread Dan Bolser
On Tue, 12 Apr 2005, Rich Carr wrote: Hi Dan, Thanks very much! First, I can't figure out how to reply to this so that it shows up in the MySQL list. How does one do it? erm... if you hit 'reply all' or answer yes to 'reply to all' it should send mail to [EMAIL PROTECTED] Ahhh...I see what

Re: Group By - Is there a way to set which rows values are used for the fields not in the Group By clause?

2005-04-12 Thread Rich Carr
Thanks again! Dan Bolser [EMAIL PROTECTED] wrote:On Tue, 12 Apr 2005, Rich Carr wrote: Hi Dan, Thanks very much! First, I can't figure out how to reply to this so that it shows up in the MySQL list. How does one do it? erm... if you hit 'reply all' or answer yes to 'reply to all' it should

Group By - Is there a way to set which rows values are used for the fields not in the Group By clause?

2005-04-11 Thread Rich Carr
Is there a way to set which rows values are used by the GROUP BY clause for the fields that are not in the GROUP BY clause? In this following select statement the group by and order work but the value of the lastviewtime field is not the value of the most recent datetime row. Is there any