Mark,
           have you tried leaving out the count() selection? I have had
difficulty with queries like that - mixing columns with functions.
Guess the 'group by' should take care of that ... but make sure
the rest of the query works, first.
I suggest you try just sticking to valid columns, introducing lots of 
parentheses for testing purposes ( I enclose damn near EVERYTHING
in parentheses before passing it to the BDE - it made a lot of things work
that previously, and mysteriously wouldn't). 
I must fly, haven't too much time to try and nut out the rest of your 
queries ;-) But I can't see anything wrong with it at a glance unless the 
parser's trying to do an AND operation somewhere in the wrong place ( see 
above).

-P.

> 'allo, I have the following sql statement, but instead of returning 
> jobgroup2_ref I want to return Jobgroup.title where Jobgroup.jobgroup_ref =
> Job.jobgroup2_ref, only, when I change the query to do that, it doesn't
> (oracle), it just fails to run the query at all.
> 
> 
> select
>   Job.jobgroup2_ref, count(job_ref) as theJobCount
> from
>   Job, Jobstatus
> where
>   Job.jobstatus_ref = Jobstatus.jobstatus_ref and
>   user_flag_1 = 'N' and
>   status_ai <> 'I'
> group by
>   Job.jobgroup2_ref
> 
> 
> I tried changin the query to:
> 
> select
>   Jobgroup.title, count(Job.job_ref) as theJobCount
> from
>   Job, Jobstatus, Jobgroup
> where
>   Job.jobstatus_ref = Jobstatus.jobstatus_ref and
>   user_flag_1 = 'N' and
>   status_ai <> 'I'
>   and Job.jobgroup2_ref = Jobgroup.jobgroup_ref
> group by
>   Jobgroup.title
> 
> But I get "column ambiguously defined" errors, what am I missing?
> 
> 
> -- 
> There are exceptions, I'm sure, but the Windows 2000 on-line community
> seems to have, in general, the moral and spiritual qualities of your
> average porn site. (c) Bryan Pfaffenberger, Linux Journal, Jan 2001.
> ---------------------------------------------------------------------------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED] 
> with body of "unsubscribe delphi"
> 


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to