I have tow tables first one
Oils table
| id | fullname |amount
| 1 | Salma | 70 |
| 2 | Ali | 20 |
| 3 | adams | 40 |
Second one
Picking_history
| id|oil_id|first|second|third|date
| 1 | 3 | 5 | 10 | 25| 11-2023
I want sql query that can get me results like this.
|id|fname|amount|first|Second|thid
| 1|Salem| 70 | | | |
| 2|Ali | 20 | | | |
I'm used this sql code
SELECT
Packing_history.id,
Oils.fullname,
amount,
Packing_history.first,
Packing_history.second,
Packing_history.third
FROM
Packing_history
INNER JOIN
Oils
ON
Packing_history oil_id != Oils.id
WHERE
Packing_history.date != '11-2023'
GROUP BY
Packing_history.id
How I can fix this problem?
source https://stackoverflow.com/questions/77423289/get-data-by-month-of-years
No comments:
Post a Comment