Mark

I'd guess that one of the cols you've referenced appears in more than 1
table, can you alias? ala

select
   a.title, count(a.job_ref) as theJobCount
from
   Job a, Jobstatus b, Jobgroup b
where
   a.jobstatus_ref = b.jobstatus_ref and
   a.jobgroup2_ref = c.jobgroup_ref and
   b.user_flag_1 = 'N' and
   b.status_ai <> 'I' and
group by
   a.title

I find when working with a lot of tables with similar Names ie Job... it's
easy
to ref the wrong table the a,b,c alias breaks the monotony

HTH

Neven


----- Original Message -----
From: "Mark Derricutt" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Friday, March 30, 2001 12:35 PM
Subject: [DUG]: group by queries...


> '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