My English is poor, please forgive me.
The first time I use SQLite database.
I've read the full page instructions of JSON1, But I don't know how to use
JSON1 to query multiple layers JSON data.
The Data as follows :
{
id: 1,
data: {
customer: 1,
goods: [
{ id: 1, name: "apple", price: 12, num: 10,
amount: 120 },
{ id: 2, name: "perl", price: 10, num: 5,
amount: 50 }
]
}
}
{
id: 2,
data: {
customer: 2,
goods: [
{ id: 1, name: "apple", price: 12, num: 10,
amount: 120 },
{ id: 2, name: "perl", price: 10, num: 5,
amount: 50 },
{ id: 3, name: "banana", price: 10, num: 5,
amount: 50 }
]
}
}
{
id: 3,
data: {
customer: 2,
goods: [
{ id: 1, name: "apple", price: 12, num: 10,
amount: 120 }
]
}
}
How can I count the amount and num of goods when the customer or
goods name is different.
I only write the SQL:
select json_extract(data, '$.goods') from table_name where
customer = 2
When I got the data, I use the programming language to loop the results and add
amount and num by myself.
Can you help me, tell me how I should write this.
And thanks for your help, your sqlite database is good database, I will
continue to use it on my program.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users