>Some days may be missing if it is a holiday, which means I can't
>guarantee each week will have a sales row for Monday or Saturday.
>Do I need to write a program to do this? Or can it be done with
SQL? TIA
Group by WEEK(sale_date), or build a calendar table and join from it.
PB
mos wrot
I can't get my head around this, but I think I should be able to do it
using just SQL without writing a program.
I have a simple table that looks like:
Rcd_Id: Integer;
Sale_Date: Date;
Sale_Amt: Double;
Each date will have 1 row with the total sales for that day.
and I want to sum the weekly
e the value of just one row of every
Cod_P in log table.
this way it works
update `master`
set Total = (select sum(Import) from `log` where
`master`.Cod_P=`log`.Cod_P)
but I get 1 warning (I don't know what warning) and I deem this way
inefficient in case I have to summarize several col
om ( select sum(Import) TotalImport, log.Cod_P
> >> from master inner join log
> >> on (master.Cod_P=log.Cod_P)
> >> group by log.Cod_P) t
> >>where master.Cod_P = t.Cod_P
> >>
> >>which, IMHO, is a clean way to do this.
> >
is way it works
update `master`
set Total = (select sum(Import) from `log` where
`master`.Cod_P=`log`.Cod_P)
but I get 1 warning (I don't know what warning) and I deem this way
inefficient in case I have to summarize several columns. I would need to
write
update `master`
set Total = (sel
n log table.
>
> this way it works
>
> update `master`
> set Total = (select sum(Import) from `log` where
> `master`.Cod_P=`log`.Cod_P)
>
> but I get 1 warning (I don't know what warning) and I deem this way
> inefficient in case I have to summarize severa
and I deem this way
inefficient in case I have to summarize several columns. I would need to
write
update `master`
set Total = (select sum(Import) from `log` where
`master`.Cod_P=`log`.Cod_P),
set Total1 = (select sum(Import1) from `log` where
`master`.Cod_P=`log`.Cod_P),
set Total2 =
Hi,
Select Sum(ifnull(column1,0)+ifnull(column2,0)+
...+ifnull(columnn,0)) From tbl group by ..
Anvar.
At 11:34 PM 05/03/2002 +0100, you wrote:
>Dear,
>
>I am stuck on something,
>I would like to summarize multiple columns to a total value in a query and
>then display the out
Dear Alainq,
> I am stuck on something,
> I would like to summarize multiple columns to a total value in a query
and
> then display the output with php in a table.
> the summarize works for 1 column but not for two or more.
> any suggestions >?
So is what you are doing some
e.
Cheers,
# Nathan
- Original Message -
From: "Alainq" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 05, 2002 3:34 PM
Subject: Summarize
Dear,
I am stuck on something,
I would like to summarize multiple columns to a total value in a query and
the
Dear,
I am stuck on something,
I would like to summarize multiple columns to a total value in a query and
then display the output with php in a table.
the summarize works for 1 column but not for two or more.
any suggestions >?
Thanks a
11 matches
Mail list logo