Re: Query query

2011-12-06 Thread Jan Steinman
From: Arthur Fuller fuller.art...@gmail.com You should still lose the pointless WHERE 1. Besides being pointless, is there any harm in having a superfluous WHERE 1 beyond the few microseconds it takes to parse it and throw it away? Just curious, because phpMyAdmin includes it in its query

Re: Query query

2011-12-04 Thread Arthur Fuller
You should still lose the pointless WHERE 1. Arthur On Sun, Dec 4, 2011 at 1:38 AM, Jan Steinman j...@bytesmiths.com wrote: DOH! Brain unfroze, and I realized I needed an aggregate: SELECT COUNT(lib.Dewey) AS Have, ddn.Dewey AS DDN, ddn.Classification AS Classification FROM

Re: Query query

2011-12-04 Thread Hal�sz S�ndor
Well, of that which you showed you _need_ only this, not really different from that which you wrote: SELECT COUNT(lib.Dewey) AS Have, ddn.Dewey AS DDN, ddn.Classification FROM s_library_dewey ddn LEFT OUTER JOIN s_library lib ON ddn.Dewey = FLOOR(lib.Dewey) GROUP BY ddn.Dewey As for

Query query

2011-12-03 Thread Jan Steinman
I'm having brain freeze, and wonder if anyone can help me with a query. I have a library in MySQL. There's a table with a record per book, and other tables that it indexes into for meaningful info. One of those is an integer-keyed list of 1,000 Dewey Decimal Codes. In the books table, the Dewey

Re: Query query

2011-12-03 Thread Jan Steinman
Second attempt, using a join, returns just one row for Dewey 000 with the COUNT being about half the volumes in the library, which isn't right... I thought a LEFT OUTER JOIN would have returned a record for every record in s_library_dewey, but it only returns the first. Brain freeze again...

Re: Query query

2011-12-03 Thread Peter Brawley
On 12/3/2011 9:35 PM, Jan Steinman wrote: Second attempt, using a join, returns just one row for Dewey 000 with the COUNT being about half the volumes in the library, which isn't right... I thought a LEFT OUTER JOIN would have returned a record for every record in s_library_dewey, but it only

Re: Query query

2011-12-03 Thread Jan Steinman
DOH! Brain unfroze, and I realized I needed an aggregate: SELECT COUNT(lib.Dewey) AS Have, ddn.Dewey AS DDN, ddn.Classification AS Classification FROM s_library_dewey ddn LEFT OUTER JOIN s_library lib ON ddn.Dewey = FLOOR(lib.Dewey) WHERE 1 GROUP BY ddn.Dewey ... although if there

Complicated query. query help

2002-11-13 Thread TimeWalker
I've been trying to work out a complicated query to select and sum multiple columns in one select using a condition and multi column group by What I expected to get was ONE row with the columns summed . this query returns 5 rows SELECT

Re: Complicated query. query help

2002-11-13 Thread Roger Baklund
* TimeWalker I've been trying to work out a complicated query to select and sum multiple columns in one select using a condition and multi column group by What I expected to get was ONE row with the columns summed . this query returns 5 rows SELECT