> Cool you mean it will work... ;) I haven't checked but we do > something
similar I think
I didn't test it, but I think it will work - assuming that your DB engine
supports GROUP BY in nested queries.
>Incidentally how SQL implementations do restrict this type of >SQL - is it
mainly
>just the grouping functions that are limited or are subqueries in >general
weakened
>on a lot of SQL implementations.
GROUP BY is finicky. You can't use the field order numbers like you can
with ORDER BY (as SELECT A,B,C FROM T ORDER BY 1,2). You can't use either
in a subquery (although I think Access might allow GROUP BY in a subquery).
A general rule of thumb is that your subqueries should be focused and return
a single record anyway - GROUP BY implies that you're going to get several
records, each with it's own aggregate field (SUM, COUNT, etc).
> It's useful to have the
> INSERT IN DATA_AUDIT (AUDITSTAMP,A,B,C,D)
> SELECT SYSDATE,A,B,C,D FROM DATA WHERE ...;
> DELETE FROM DATA WHERE ...;
I'm not aware of any way to do this in one statement, because you have two
action verbs: INSERT and DELETE. Each single SQL statement can do a whole
lot of SELECTing, but can only do one of INSERT, UPDATE or DELETE.
Cheers.
BJ...
---------------------------------------------------------------------------
New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz