1
I’ve been trying to figure this out for three days and I haven’t found the answer anywhere
I have a table in the database where I need to do a SELECT on all products but they need to be sorted according to the average between date X and date X, a basic example of table q I did quickly
SELECTS and GROUPS are working, it’s only ORDER that I can’t solve, one of several queries I tried unsuccessfully to organize the Rows:
SELECT product, time, date FROM graficos
ORDER BY time HAVING (date BETWEEN 2017-02-20 AND 2017-02-23) DESC
Well summarized example in more detail (the original table is too giant to paste here):
-------------------------------
PRODUCT | TIME | DATE |
Bombom | 35 | 2017-02-15 |
Gato | 25 | 2017-02-20 |
Pizza | 28 | 2017-02-23 |
-------------------------------
Exit:
-------------------------------
Pizza | 28 | 2017-02-23 |
Gato | 25 | 2017-02-20 |
Bombom | 0 | 2017-02-15 |
-------------------------------
Exemplify with table records. What are the records and how you need the output?
– Murillo Goulart
I just gave an update with the details you asked Murillo
– Mauro