On 05/07/07, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
The fact that GROUP BY follows ORDER BY, of course. You are probably not
surprised that you can't, say, put WHERE clause in front of FROM clause
or SELECT clause - why are you surprised that other clauses must also be
used in a certain
On 05/07/07, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
Add "group by eid"
For
SELECT eid, P, subcase
FROM temp a1
WHERE NOT EXISTS (
SELECT *
FROM temp a2
WHERE a2.eid == a1.eid AND a2.P < a1.P
)
ORDER BY eid
GROUP BY eid;
I get a syntax error, complaining about GROUP. If I switch the ORDER
On 04/07/07, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
For each unique eid you look for a record with this eid where P is
smallest. Another way to express "smallest" is to say: there doesn't
exist a record with the same eid and a smaller value of P. Which is
precisely what my "not exists" clause
The following query works fine (and is quick), but I can't help
thinking that it should be possible to it with a single SELECT and a
self join.
CREATE TEMPORARY TABLE temp (eid INT, P DOUBLE);
INSERT INTO temp (eid, P)
SELECT eid, MIN(P)
FROM barforce_1
GROUP BY eid;
SELECT a1.eid, a1.P,
4 matches
Mail list logo