Re: Can't get expected SELECT GROUP BY results

2008-12-26 Thread Fish Kungfu
Thank you, Peter! I'll give that a try. ~~Fish~~ On Fri, Dec 26, 2008 at 2:33 PM, Peter Brawley wrote: > Sorry LOL, make that http://www.artfulsoftware.com/infotree/queries.php. > > PB > > - > > > Peter Brawley wrote: > > What I want to do is SELECT only the most recent dateTime and critte

Re: Can't get expected SELECT GROUP BY results

2008-12-26 Thread Peter Brawley
Sorry LOL, make that http://www.artfulsoftware.com/infotree/queries.php. PB - Peter Brawley wrote: What I want to do is SELECT only the most recent dateTime and critterXYZ for each critterName and return one row for each unique critterName. For examples & discussion see "Within-group ag

Re: Can't get expected SELECT GROUP BY results

2008-12-26 Thread Peter Brawley
What I want to do is SELECT only the most recent dateTime and critterXYZ for each critterName and return one row for each unique critterName. For examples & discussion see "Within-group aggregates" at http://localhost/artful/infotree/queries.php. PB - Fish Kungfu wrote: I have a datase

Can't get expected SELECT GROUP BY results

2008-12-26 Thread Fish Kungfu
I have a dataset like this: +++--+-+ |regionName|critterName|critterXYZ|dateTime | +++--+-+ |

RE: SELECT...GROUP BY WITHIN GROUP BY

2006-11-30 Thread Kerry Frater
2006 20:56 To: [EMAIL PROTECTED] Cc: mysql@lists.mysql.com Subject: Re: SELECT...GROUP BY WITHIN GROUP BY I'm not sure that this is exactly what you want, but I think you can use the WITH ROLLUP modifier: select district, town, street, surname, count(surname) from test5 group by distric

RE: SELECT...GROUP BY WITHIN GROUP BY

2006-11-28 Thread Kerry Frater
count the number of towns at the end of each district report the district, no. of towns, no. of streets, no. surnames when all rows are processed report the no. of districts, no. of towns, no. of streets, no. surnames I was hoping to do this with a clever combination of SELECT, GROUP BY, etc.

Re: SELECT...GROUP BY WITHIN GROUP BY

2006-11-28 Thread ddevaudreuil
OLLUP http://dev.mysql.com/doc/refman/5.0/en/group-by-modifiers.html Donna "Kerry Frater" <[EMAIL PROTECTED]> 11/28/2006 02:31 PM Please respond to <[EMAIL PROTECTED]> To cc Subject SELECT...GROUP BY WITHIN GROUP BY Hope I have the right group. I am working out

SELECT...GROUP BY WITHIN GROUP BY

2006-11-28 Thread Kerry Frater
Hope I have the right group. I am working out how to get groups within groups. e.g. I have a table with 4 columns C1,C2,C3 & C4 I am looking to select data so that I can get C1 group item C2 Group item C3 Group Item C4 detail End of C3 Group Item count/totals of

Re: Get lines matching a select / group by query

2004-09-21 Thread Alexander Newald
- Original Message - From: "Wesley Furgiuele" <[EMAIL PROTECTED]> To: "Alexander Newald" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, September 21, 2004 1:41 AM Subject: Re: Get lines matching a select / group by query Use COUNT(): S

Re: Get lines matching a select / group by query

2004-09-20 Thread Wesley Furgiuele
Use COUNT(): SELECT COUNT( id ) FROM test WHERE LEFT( id, 5 ) = '12345' GROUP BY value; Wes On Tue, 21 Sep 2004 00:24:33 +0200, Alexander Newald <[EMAIL PROTECTED]> wrote: > Hello, > > I like to get the number of lines returned by a select ... group by query: >

Get lines matching a select / group by query

2004-09-20 Thread Alexander Newald
Hello, I like to get the number of lines returned by a select ... group by query: Example: SELECT id FROM test WHERE LEFT(id,5) = "12345" GROUP BY value; Perhaps I will get +---+ | id| +---+ | 2 | | 1 | | 5 | +---+ 3 rows in set

Re: SELECT ... GROUP BY

2004-03-07 Thread Michael Stassen
mailto:[EMAIL PROTECTED] Sent: Monday, 8 March 2004 14:03 To: Darran Kartaschew; [EMAIL PROTECTED] Subject: Re: SELECT ... GROUP BY You need to do this in 2 steps. Step 1: select user_id, max(last_updated) as max_last_updated from posts group by user_id You probably need to do this into a tem

RE: SELECT ... GROUP BY

2004-03-07 Thread Darran Kartaschew
Excellent, that worked... Yours Sincerely Darran -Original Message- From: Daniel Kasak [mailto:[EMAIL PROTECTED] Sent: Monday, 8 March 2004 14:03 To: Darran Kartaschew; [EMAIL PROTECTED] Subject: Re: SELECT ... GROUP BY You need to do this in 2 steps. Step 1: select user_id, max

RE: SELECT ... GROUP BY

2004-03-07 Thread Darran Kartaschew
MySQL the proper place to do this stuff... Darran -Original Message- From: Donny Simonton Sent: Monday, 8 March 2004 13:49 To: Darran Kartaschew; [EMAIL PROTECTED] Subject: RE: SELECT ... GROUP BY You should change it to something like this: Select * from posts group by user_id ord

Re: SELECT ... GROUP BY

2004-03-07 Thread Daniel Kasak
Darran Kartaschew wrote: Warning: SQL newbie... I'm trying to create a query where the most recent entry for each user is returned from a forum table, and sorted by username. The fields are simply: user_id, username, post, last_updated. No primary key defined. I've tried the simple "SELECT

RE: SELECT ... GROUP BY

2004-03-07 Thread Donny Simonton
; To: [EMAIL PROTECTED] > Subject: SELECT ... GROUP BY > > Warning: SQL newbie... > > I'm trying to create a query where the most recent entry for each user is > returned from a forum table, and sorted by username. The fields are > simply: user_id, username, post, last_upda

SELECT ... GROUP BY

2004-03-07 Thread Darran Kartaschew
Warning: SQL newbie... I'm trying to create a query where the most recent entry for each user is returned from a forum table, and sorted by username. The fields are simply: user_id, username, post, last_updated. No primary key defined. I've tried the simple "SELECT * FROM posts GROUP BY user_id

Re: question on "select group by a 'set' field"

2003-02-11 Thread Anya
Thanks, Fred. It works perfectly. At 01:00 PM 2/11/2003 +0100, Fred van Engen wrote: >Hello Anya, > >On Tue, Feb 11, 2003 at 07:51:00PM +0800, Anya wrote: >> >> >> Dear all, >> I have a table Kids which has the following fields: >> >> kid char(20), >> favorite_fruits set('apple','pear','orange

Re: question on "select group by a 'set' field"

2003-02-11 Thread Fred van Engen
Hello Anya, On Tue, Feb 11, 2003 at 07:51:00PM +0800, Anya wrote: > > > Dear all, > I have a table Kids which has the following fields: > > kid char(20), > favorite_fruits set('apple','pear','orange',) > > favorite_fruits has choices of up to 64 items. > > Now I want to query the count o

question on "select group by a 'set' field"

2003-02-11 Thread Anya
Dear all, I have a table Kids which has the following fields: kid char(20), favorite_fruits set('apple','pear','orange',) favorite_fruits has choices of up to 64 items. Now I want to query the count of each fruit appears in the favorite_fruits of the kids in the table. Is there anyway to

Re: Help me with SELECT - GROUP BY - IF

2001-10-03 Thread Benjamin Pflugmann
Hi. On Tue, Oct 02, 2001 at 01:02:19PM +0100, [EMAIL PROTECTED] wrote: > >Hi there. I have problems with mySQL > > >What I would like to do is: > > >I have a statement > > >SELECT a.id AS ID, IDmark, IDrecipe, ocenjevalec, ocena, > >ROUND(AVG(ocena),1) as povprecje, COUNT(*) as all, IF (ID=oce

Re: Help me with SELECT - GROUP BY - IF

2001-10-02 Thread Jerry
>Hi there. I have problems with mySQL >What I would like to do is: >I have a statement >SELECT a.id AS ID, IDmark, IDrecipe, ocenjevalec, ocena, >ROUND(AVG(ocena),1) as povprecje, COUNT(*) as all, IF (ID=ocenjevalec, >'yes', 'no') as zeocenil >FROM ocenerecepti, obiskovalci >WHERE IDrecept = 13