我有2个select语句。如果选择查询返回空结果,请在mysql中运行另一个select查询
1- select sm.id, IFNULL(sm.unit_price,0) as unit_price
from crm_stock_manager sm
left join crm_purchase_order_items poi on poi.id = sm.purchase_order_item_id and poi.is_del = 0
left join crm_products p on poi.product_id = p.id and p.is_del = 0
where sm.is_del = 0 and IFNULL(sm.unit_price, '') != '' and p.id = 253 order by sm.created_on;
2- select 0 as id ,price as unit_price from crm_products where id = 253 and is_del=0;
如果第一个select语句返回一个空结果,那么我想运行第二个select语句。
请帮帮我。
只需执行2个独立的查询,陆续 – zerkms 2013-02-27 04:55:56
是否有任何可能的方式来做到这一点在MySQL? – 2013-02-27 05:01:17
是否有任何理由在mysql中这样做? – zerkms 2013-02-27 05:05:09