Group: microsoft.public.access
From: =?Utf-8?B?bGRpYXo=?=
Date: Monday, October 22, 2007 1:47 PM
Subject: RE: two columns in Query (BAM-06, JAXM-06)

Hi Ken, your expression had an error on WHERE condition but I have fixed and
shows as follow:
SELECT IDVolatilDBID_lbl.User6,
Sum(IDVolatilDBID_lbl.Qty*IIf(IDVolatilDBID_lbl.Planner="BAM-06",1,0)) AS
[Sum Of Qty (BAM-06)],
Sum(IDVolatilDBID_lbl.Qty*IIf(IDVolatilDBID_lbl.Planner="JAXM-06",1,0)) AS
[Sum Of Qty (JAXM-06)]
FROM To_Update_Excel_r1 INNER JOIN IDVolatilDBID_lbl ON
To_Update_Excel_r1.WO_ID = IDVolatilDBID_lbl.WO_ID
WHERE (((IDVolatilDBID_lbl.Planner)="BAM-06")) OR ((("JAXM-06")<>False))
GROUP BY IDVolatilDBID_lbl.User6
ORDER BY
Sum(IDVolatilDBID_lbl.Qty*IIf(IDVolatilDBID_lbl.Planner="BAM-06",1,0)) DESC;

I think this is correct,

I want to thanks your help on this, without your help would not have been
possible

Thanks again, you're the man


--
Lorenzo Díaz
Cad Technician


"Ken Sheridan" wrote:

> Lorenzo:
>
> Try this:
>
> SELECT IDVolatilDBID_lbl.User6,
> SUM(IDVolatilDBID_lbl.Qty*IIF(IDVolatilDBID_lbl.Planner = "BAM-06",1,0)) AS
> [Sum Of Qty (BAM-06)],
> SUM(IDVolatilDBID_lbl.Qty*IIF(IDVolatilDBID_lbl.Planner = "JAXM-06",1,0)) AS
> [Sum Of Qty (JAXM-06)]
> FROM To_Update_Excel_r1 INNER JOIN IDVolatilDBID_lbl ON
> To_Update_Excel_r1.WO_ID = IDVolatilDBID_lbl.WO_ID
> WHERE (((IDVolatilDBID_lbl.Planner)="BAM-06"))
> GROUP BY IDVolatilDBID_lbl;
>
> I'll leave you to decide on what order you now want the rows returned in.
>
> Ken Sheridan
> Stafford, England
>
> "ldiaz" wrote:
>
> > I have this query
> >
> > ==================================================
> > SELECT DISTINCTROW IDVolatilDBID_lbl.User6, Sum(IDVolatilDBID_lbl.Qty) AS
> > [Sum Of Qty]
> > FROM To_Update_Excel_r1 INNER JOIN IDVolatilDBID_lbl ON
> > To_Update_Excel_r1.WO_ID = IDVolatilDBID_lbl.WO_ID
> > WHERE (((IDVolatilDBID_lbl.Planner)="BAM-06"))
> > GROUP BY IDVolatilDBID_lbl.User6
> > ORDER BY Sum(IDVolatilDBID_lbl.Qty) DESC;
> >
> > ===================================================
> > and this shows two colums like this:
> > User6 Sum Of Qty
> > SUB-ASSY MEX 4312
> >
> > What I want, is to change this to three columns:
> > User6 Sum Of Qty (BAM-06) Sum Of Qty (JAXM-06)
> > SUB-ASSY MEX 4312 1500
> >
> > IDVolatilDBID_lbl.Planner contain datas as BAM-06 and JAXM-06
> >
> > please help
> >
> > --
> > Lorenzo Díaz
> > Cad Technician
>