Subject | RE: [firebird-support] CrossTab Select |
---|---|
Author | |
Post date | 2014-06-26T13:19:51Z |
CREATE PROCEDURE PRODS(PAC INTEGER)
RETURNS(
HOR TYPE OF HORA,
SEG TYPE OF DESCRICAO,
TER TYPE OF DESCRICAO,
QUA TYPE OF DESCRICAO,
QUI TYPE OF DESCRICAO,
SEX TYPE OF DESCRICAO,
SAB TYPE OF DESCRICAO,
DOM TYPE OF DESCRICAO)
AS
BEGIN
FOR SELECT DISTINCT HORA,
IIF(EXTRACT(WEEKDAY FROM DATAB) = 0, PRODUTO, 0),
IIF(EXTRACT(WEEKDAY FROM DATAB) = 1, PRODUTO, 0),
IIF(EXTRACT(WEEKDAY FROM DATAB) = 2, PRODUTO, 0),
IIF(EXTRACT(WEEKDAY FROM DATAB) = 3, PRODUTO, 0),
IIF(EXTRACT(WEEKDAY FROM DATAB) = 4, PRODUTO, 0),
IIF(EXTRACT(WEEKDAY FROM DATAB) = 5, PRODUTO, 0),
IIF(EXTRACT(WEEKDAY FROM DATAB) = 6, PRODUTO, 0)
FROM TABELAB
WHERE DATABBETWEEN '23.06.2014' AND '28.06.2014'
INTO :HOR, :DOM, :SEG, :TER, :QUA, :QUI, :SEX, :SAB DO
SUSPEND;
END
My select
select SEG, TER, QUA, QUI, SEX, SAB, DOM, HOR from PRODS (null)
GROUP by SEG, TER, QUA, QUI, SEX, SAB, DOM, HOR
and continues with the same result each case mean a day of the week