[AccessD] Urgent query help needed

Benson, William (GE Global Research, consultant) Benson at ge.com
Fri Jun 1 14:42:33 CDT 2012


Worked!! Thank you so much!

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Salakhetdinov Shamil
Sent: Friday, June 01, 2012 3:13 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Urgent query help needed

Hi William --

You have UNION in subquery, I guess it's not allowed (I have never used it like that).

Why not use OR instead of UNION?:

...
Where DUNS_NUMBER in
        (SELECT CHILD_CUSTOMER_DUNS 
...
OR
     DUNS_NUMBER in
      (SELECT parent_customer_duns 
          FROM  customer_hierarchy 
...

HTH,

-- Shamil


Fri, 1 Jun 2012 18:13:12 +0000 от "Benson, William (GE Global Research, consultant)" <Benson at ge.com>:
> Urgently need some help reforming this query. The error message I am getting is that this operation is not allowed in subqueries.
> 
> 
> 
> select * 
> from CMF 
> WHERE  DUNS_NUMBER in 
>                 ('CAT280669','CAT267663','969801062','832747997','832747997',
>           '832747997','832747997','824603229','808109941','600010862','338329211',
>           '338329211','325550361','325550361','089506492','081735875',
>           '059006937','059006937','059006937','024745853','006901995')
> 
> union 
> 
> Select * 
> from CMF 
> Where DUNS_NUMBER in
>         (SELECT CHILD_CUSTOMER_DUNS 
>                   FROM  customer_hierarchy 
>                   where parent_customer_duns in 
>                 ('CAT280669','CAT267663','969801062','832747997','832747997',
>           '832747997','832747997','824603229','808109941','600010862','338329211',
>           '338329211','325550361','325550361','089506492','081735875',
>           '059006937','059006937','059006937','024745853','006901995')
>          UNION 
>                  SELECT parent_customer_duns 
>          FROM  customer_hierarchy 
>                  where CHILD_CUSTOMER_DUNS in 
>                 ('CAT280669','CAT267663','969801062','832747997','832747997',
>           '832747997','832747997','824603229','808109941','600010862','338329211',
>           '338329211','325550361','325550361','089506492','081735875',
>           '059006937','059006937','059006937','024745853','006901995')
> )
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list