Hi,
We are facing an issue with the JDBC query, I need help on.
I have 3 fields, UPC_ID, QTY,Date
I have to retrieve all the records for one UPC_ID whose QTY is same for last five days. The problem here is the QTY will not be inserted on sundays. When when we run the query on a Monday, we should consider the Qty for last wednesday to saturday and for monday.
I have written a query where I retrieve the data for last 6 days considering sunday to be in the middle, and group by QTY and count of the rows is>4 i retieve the data. But when i run this on saturday, It gives me a problem as, though the QTY was different on Tuesday, the count would be >4 and that record is retieved. Please help.
My query
select UPC_ID,QTY(sele ct UPC_ID,QTY,coun t(1) as count rows where date>sysdate-6 group by UPC_ID, QTY)a1 group by QTY having sum(countrows)> 4
which gives me a wrong output when ran on saturday.
We are facing an issue with the JDBC query, I need help on.
I have 3 fields, UPC_ID, QTY,Date
I have to retrieve all the records for one UPC_ID whose QTY is same for last five days. The problem here is the QTY will not be inserted on sundays. When when we run the query on a Monday, we should consider the Qty for last wednesday to saturday and for monday.
I have written a query where I retrieve the data for last 6 days considering sunday to be in the middle, and group by QTY and count of the rows is>4 i retieve the data. But when i run this on saturday, It gives me a problem as, though the QTY was different on Tuesday, the count would be >4 and that record is retieved. Please help.
My query
select UPC_ID,QTY(sele ct UPC_ID,QTY,coun t(1) as count rows where date>sysdate-6 group by UPC_ID, QTY)a1 group by QTY having sum(countrows)> 4
which gives me a wrong output when ran on saturday.
Comment