Hello, I'm trying to make an appointment for an ordering system for a restaurant. My tables are arranged as follows:
I need to bring all tables (regardless of whether or not they have a request) if they have a request with status 0, such requests should come. If there is no request (s) with status 0 for that particular table, the request should come null.
For example :
Tables:
[1,1]
[2,1]
[3,1]
[4,1]
Orders:
[1,1,0]
[2,2,1]
[3,3,1]
[4,4,0]
[5,4,1]
[6,3,-1]
[7,2,0]
Expected result:
Table.id | Order.id
1 |1
2 |null
3 |null
4 |4
2 |7