union 组合

查询单据,却不知道单据在当前表还是在历史表

select * from wms_bill where ... union select * from wms_billhistory  where ...

 

 

或者

 

if exists(select * from wms_bill where ..) begin select * from wms_bill where ...  end else begin select * from wms_billhistory  where ... 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章