java - Query of a query in SQLite / Android -


i've been modeling queries in ms access show want , how want them before translate them on android app.

however, results require 2 queries final results -- 1 query bunch of joins, , second query joins first query additional tables. if combine them didn't see way to.

anyways, there way in sqlite allows me efficiently?

edit: example:

customers table: id, custname orders table: id, custid, itemid items table: id, itemname  query1: select orders.id orderid, orders.custid, orders.itemid, customers.custname orders left join customers on orders.custid = customers.id;  query2: select query1.orderid, query1.custid, query1.itemid, query1.custname, items.itemname query1 left join items on query1.itemid = items.id; 

i know in case can combine these two, let's pretend sufficiently complex had keep them separate. want way results of query2 in android app (which uses sqlite).

every query, regardless how complex is, can used subquery in query's clause:

select ... (select ...) query1 join ...; 

anyway, create view sounds want:

the create view command assigns name pre-packaged select statement. once view created, can used in clause of select in place of table name.

create view query1 select orders.id orderid,        orders.custid,        orders.itemid,        customers.custname orders left join customers on orders.custid = customers.id; 

Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -