Select from multiple tables in one call

前端 未结 7 1137
隐瞒了意图╮
隐瞒了意图╮ 2021-02-13 13:01

In my code I have a page that includes information from 3 different tables. To show this information I make 3 SQL select calls and unite them in one list to pass as Model to my

7条回答
  •  青春惊慌失措
    2021-02-13 13:50

    You can do something like this

    SELECT  Info1, Info2 
    FROM Table1Data
    UNION ALL
    SELECT Id, Info2 
    FROM Table2Data;
    

    Then you can parse the result. Depends on the case but you can also consider using a transaction.

提交回复
热议问题