sql實例

關聯三張表spa

<!-- 查詢(根據查詢條件分頁查詢) -->get

<select id="getListMapPage" resultType="hashmap" parameterType="hashmap">hash

SELECTit

tdmm.id as id,table

tdmm.delivery_man_id as deliveryManId,hashmap

tdmm.customer_id as customerId,List

tdmm.open_id as openId,select

 

tdm.id as customerId,map

tdm.login_name as customerLoginName,分頁

tdm.real_name as customerRealName,

 

tc.id as deliveryManId,

tc.login_name as deliveryManLoginName,

tc.real_name as deliveryManRealName

 

FROM table1 tdmm

LEFT JOIN table2 tdm  on(tdmm.delivery_man_id=tc.id)                     左關聯

LEFT JOIN table3 tc     on(tdmm.customer_id=tdm.id)

WHERE tdmm.status = 1 條件

limit ${(page-1)*pagesize},${pagesize}

</select>

相關文章
相關標籤/搜索