[prog] Another newbie SQL question

Tina tyamar at gmail.com
Wed Apr 28 18:13:51 UTC 2010


I'm trying to do the following:

SELECT shipcity, shipstate
FROM orders
WHERE order# IN (SELECT order#
FROM orders
 GROUP BY order#
HAVING MONTHS_BETWEEN(*) = (SELECT MAX(MONTHS_BETWEEN(shipdate, orderdate))
 FROM orders
GROUP BY order#));

The problem is I can't use HAVING MONTHS_BETWEEN(*). What should I do
instead?

-- Tina


More information about the Programming mailing list