Subject | Re: [firebird-support] Dumb Question |
---|---|
Author | Helen Borrie |
Post date | 2003-12-10T08:30:34Z |
At 01:12 PM 9/12/2003 +0000, you wrote:
execute a script in isql) -- if you want somehow to list these maximum
values in a meaningful way, why not just run a union query:
SELECT 'TABLE1' as tablename, MAX(ID)
FROM TABLE1
UNION
SELECT 'TABLE2' as tablename, MAX(ID)
FROM TABLE2
UNION
SELECT 'TABLE3' as tablename, MAX(ID)
FROM TABLE3
UNION
.....
?
You could also define a view from these statements and then just use the
output as required, with a search condition on the tablename column.
/heLen
>In Oracle I'm used to using SQL to create SQL scripts. While I canForgetting about scripts for now (presumably you've discovered you can
>do the same in Firebird I can't seem to figure out how to run
>multiple statements as a script.
>
>EXAMPLE
>
>SELECT MAX(ID) FROM TABLE1;
>SELECT MAX(ID) FROM TABLE2;
>SELECT MAX(ID) FROM TABLE3;
execute a script in isql) -- if you want somehow to list these maximum
values in a meaningful way, why not just run a union query:
SELECT 'TABLE1' as tablename, MAX(ID)
FROM TABLE1
UNION
SELECT 'TABLE2' as tablename, MAX(ID)
FROM TABLE2
UNION
SELECT 'TABLE3' as tablename, MAX(ID)
FROM TABLE3
UNION
.....
?
You could also define a view from these statements and then just use the
output as required, with a search condition on the tablename column.
/heLen