Could anybody explain me what is the use of using at the same time HAVING and WHERE for the same field in anSQL statment.
Example:
SELECT Table1.A, Table2.B,
FROM Table1, Table2
INNER JOIN Table1 on Table1.A = Table2.A
WHERE Table1.A 'Criteria1'
GROUP BY Table1.A, Table2.B
HAVING Table1.A 'Criteria2'
*Where I suppose that criteria1 and criteria2 arre valid criteria like = 1 or in ("a","b","c") etc
Seems to give the same result than
SELECT Table1.A, Table2.B,
FROM Table1, Table2
INNER JOIN Table1 on Table1.A = Table2.A
GROUP BY Table1.A, Table2.B
HAVING Table1.A 'Criteria2 AND Criteria1'
I could not see any difference on various examples. Of course it does not mean that there is no difference as a general rule. If anybody knows a counter-example or could explain the eventual difference in general terms, I would be grateful.
Alex
Example:
SELECT Table1.A, Table2.B,
FROM Table1, Table2
INNER JOIN Table1 on Table1.A = Table2.A
WHERE Table1.A 'Criteria1'
GROUP BY Table1.A, Table2.B
HAVING Table1.A 'Criteria2'
*Where I suppose that criteria1 and criteria2 arre valid criteria like = 1 or in ("a","b","c") etc
Seems to give the same result than
SELECT Table1.A, Table2.B,
FROM Table1, Table2
INNER JOIN Table1 on Table1.A = Table2.A
GROUP BY Table1.A, Table2.B
HAVING Table1.A 'Criteria2 AND Criteria1'
I could not see any difference on various examples. Of course it does not mean that there is no difference as a general rule. If anybody knows a counter-example or could explain the eventual difference in general terms, I would be grateful.
Alex