Sql中採用標籤遍歷拼接兩個list集合

2021-09-10 04:34:12 字數 593 閱讀 3412

sql中採用標籤遍歷拼接兩個list集合

要求:「citys」:[1, 3],//區域查詢,陣列形式,不傳不傳預設查詢當前許可權的所有區域

「brands」:[1, 3],//品牌查詢,陣列形式,不傳不傳預設查詢所有

select e.*,b.name from bd_enterprise e left join bd_dc_brand b on e.brand = b.id left join bd_enterprise_report bra on bra.license_num=e.license_num where citys in # and brands in #

正解

採用where標籤。

select be.*,b.name from bd_enterprise_branch be left join bd_enterprise e on be.subordinate_enterprise=e.license_num left join bd_dc_brand b on e.brand = b.id be.branch_city or be.branch_contact_city in # and e.brand in #

sql中兩個日期相減

sql中兩個日期相減 1 相差天數 select trunc sysdate,yyyy to date 2009 01 04 yyyy mm dd from dual 2 相差月數 select months between trunc sysdate,mm to date 2009 01 yyyy...

sql中兩個日期相減

sql中兩個日期相減 1 相差天數 select trunc sysdate,yyyy to date 2009 01 04 yyyy mm dd from dual 2 相差月數 select months between trunc sysdate,mm to date 2009 01 yyyy...

兩個開發中碰到的sql錯誤

select from table1 o table2 i left join table3 p on o.id p.id結果報錯 err 1054 unknown column o.order id in on clause 原因是left join 連線的時左右相連的兩個table,連不到tab...