SQL Select With Multiple References to Single Table

前端 未结 3 1737
悲&欢浪女
悲&欢浪女 2021-02-19 11:22

I have a SQL DB that contains multiple relational tables. There are some fields in the master table that reference another table multiple times. For example, say I have a data

3条回答
  •  北荒
    北荒 (楼主)
    2021-02-19 11:52

    select tbl_book_con1.city,con1,tbl_book_destination.city,destination,labar_char,tbl_book_c_from.city,c_from,tbl_book_c_to.city,c_to,tbl_book_payment.city,paymentid from tbl_booking tbb_bookinner join tbl_master tbl_book_con1 on tbl_book_con1.id = tbb_book.con1
    inner join tbl_master tbl_book_destination on tbl_book_destination.id = tbb_book.con1
    inner join tbl_master tbl_book_c_from on tbl_book_c_from.id = tbb_book.con1
    inner join tbl_master tbl_book_c_to on tbl_book_c_to.id = tbb_book.con1
    inner join tbl_master tbl_book_payment on tbl_book_payment.id = tbb_book.con1

提交回复
热议问题