Home > database >  Excuse me, database multilevel across the table to do
Excuse me, database multilevel across the table to do

Time:10-13

Eg. A table b_id associated with B table id, need according to the type of table B type choose corresponding query table, such as B.t ype==1, select table B1, B1. User_id=a. _id, B.t ype==2, select B2, B2. User_id=a. _id, B.t ype==3, choose B3, B3. User_id=a. _id,

Select * from A
Left the join on B.i d=B a. _id

According to B.t ype the value of the associated query on to the next step, can solve it by a transaction, as long as the returns all the data corresponding to B1 and B2 and B3
  • Related