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
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
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
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
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...
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
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
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
* 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