Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ORA-00904 Invalid column name for SELECT COUNT(DISTINCT ...) with Oracle 9i and ADO
"Phil Jollans" <nospam_at_messring.de> wrote in message news:<b9qf57$kbblq$1_at_ID-178233.news.dfncis.de>...
> Our application uses a select statement in the form
> SELECT COUNT ( DISTINCT <column> ) FROM <table>
> on an Oracle database.
>
> We are accessing the database using ADO and the Oracle OLEDB driver OraOledb
> (not MsdaOra).
>
> This query works fine with the Oracle 8.1.7 client software, but returns an
> error with the Oracle 9i client software. It does not appear to matter
> whether the server is 8i or 9i.
>
> The query works fine from SQL-Plus Worksheet, but fails in our application.
> It also fails using a simple ADO based query tool (QTADO) using the oledb
> provider OraOledb.
>
> The error is Invalid Column Name ORA-00904.
>
> The error does not occur with SELECT COUNT, or with SELECT DISTINCT, but
> always occurs when they are combined.
>
> Any help would be appreciated,
>
> Phil
Just a guess. Did you try using an alias? Like Select count(distinct column_name) header from ....
where header is the alias.
![]() |
![]() |