Nicolas Penot
Posted on May 3, 2021
Query example:
select users.username, users.email, orders.id, orders.date, orders.amount
from users, orders
where users.trid = orders.user_trid
and users.user_trid in ( 31, 32, 33 )
and users.status = 1
Option 1: GET - Query in the URL
https://server.com/query?q=select%20users.username%2C%20users.email%2C%20orders.id%2C%20orders.date%2C%20orders.amount%20from%20users%2C%20orders%20where%20users.trid%20%3D%20orders.user_trid%20and%20users.user_trid%20in%20%28%2031%2C%2032%2C%2033%20%29%20and%20users.status%20%3D%201
Option 2: POST - JSON Payload
[{
"query": "select users.username, users.email, orders.id, orders.date, orders.amount from users, orders where users.trid = orders.user_trid and users.user_trid in ( 31, 32, 33 ) and users.status = 1"
}]
Return
{
"users": [{
"username": "usr_name_1",
"email": "usr_name_1@gmail.com",
"orders": [{
"id": 2543,
"date": "2020.08.11",
"amount": 35.99
}, {
"id": 2843,
"date": "2020.10.01",
"amount": 45.99
}, {
"id": 3843,
"date": "2020.12.23",
"amount": 395.99
}]
}, {
"username": "usr_name_2",
"email": "usr_name_2@gmail.com",
"orders": [{
"id": 3815,
"date": "2021.01.11",
"amount": 35.99
}, {
"id": 3176,
"date": "2021.02.03",
"amount": 45.99
}, {
"id": 3898,
"date": "2020.03.05",
"amount": 395.99
}]
}]
}
Original issue: https://github.com/siodb/siodb/issues/133
💖 💪 🙅 🚩
Nicolas Penot
Posted on May 3, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.