[Info-Ingres] How to get number of returned rows of another select query?

Roy Hann specially at processed.almost.meat
Fri May 18 03:44:31 CDT 2007


"John Dennis" <denjo02 at hotmail.com> wrote in message 
news:1179475707.837009.209350 at u30g2000hsc.googlegroups.com...
> Works in 2006 release 2:
>
> apj-sol1..~ i2006r2 > sql jrd
> INGRES TERMINAL MONITOR Copyright 2007 Ingres Corporation
> Ingres 2006 Release 2 SPARC SOLARIS Version II 9.1.0 (su9.us5/123)
> login
> Fri May 18 18:08:31 2007
>
> continue
> * select count(*) from ( select distinct c1 from t1) as row_count;
> * \g
> Executing . . .
>
>
> +-------------+
> ¦col1         ¦
> +-------------¦
> ¦            2¦
> +-------------+
> (1 row)

A couple of people have suggested adding "...as row_count" or similar to the 
end of the query to make it work.  It makes the error message go away, but 
not for the reason being suggested.  If you look at the output from this 
example you will see that the "...as row_count" is being ignored; the result 
column is being called "col1".

What's happened here is that the word "as" seems to have been taken as the 
correlation name for the result table.  Goodness knows why "row_count" 
wasn't then flagged as a syntax error though.

Roy

Ingres Users Association Spring Conference, 6 June 2007, London
Secure your place by registering NOW via the IUA web site
http://www.iua.org.uk/





More information about the Info-Ingres mailing list