php - select data for "some value" if data null then select data for field IS NULL -
here have query returns cost respective condition... doing now... here haveing conditon checking event_id null or event_id = "some value" ... think wrong want fetch info rows if there info exist "some value" should homecoming info if there no info "some value" should check null..
here want query info event_id
1) event_id int should homecoming info event_id
2) if (1) info null theen should select info event_id null
how can thing query
query 1 (checks event_id) :
select `tpliv`.`ticket_sub_type_id` `ticketsubtypeid` , `tst`.`ticket_sub_type` `ticketsubtype` , `tpliv`.`price` `ticketprice` , `tpliv`.`tax` `tickettax` , `tpliv`.`ticket_price_list_item_vendor_id` `ticketpricelistid` , `tpliv`.`ticket_price_list_id` `ticketpricelist` , `tpliv`.`fee` `ticketfee` , `tpliv`.`status` `status` `ticket_price_list_item_vendor` `tpliv` bring together `ticket_price_list` `tpl` on tpl.ticket_price_list_id =tpliv.ticket_price_list_id , tpl.event_group_id = "45" , tpl.vendor_id = "442" , tpl.dinner_category_id null , tpl.status =1 , tpl.event_id = "39152" , tpl.seat_section_id null , tpl.vendor_sub_group_id null , tpl.vip_seat_id null , tpl.seat_block_section_id null , tpl.is_upsale null bring together `ticket_sub_types` `tst` on tst.ticket_sub_type_id = tpliv.ticket_sub_type_id , tst.status =1 bring together `ticket_sub_type_vendor` `tstv` on tstv.ticket_sub_type_id=tst.ticket_sub_type_id , tstv.status =1 limit 0 , 30
query 2 (checks event_id null) :
select `tpliv`.`ticket_sub_type_id` `ticketsubtypeid` , `tst`.`ticket_sub_type` `ticketsubtype` , `tpliv`.`price` `ticketprice` , `tpliv`.`tax` `tickettax` , `tpliv`.`ticket_price_list_item_vendor_id` `ticketpricelistid` , `tpliv`.`ticket_price_list_id` `ticketpricelist` , `tpliv`.`fee` `ticketfee` , `tpliv`.`status` `status` `ticket_price_list_item_vendor` `tpliv` bring together `ticket_price_list` `tpl` on tpl.ticket_price_list_id =tpliv.ticket_price_list_id , tpl.event_group_id = "45" , tpl.vendor_id = "442" , tpl.dinner_category_id null , tpl.status =1 , tpl.event_id null , tpl.seat_section_id null , tpl.vendor_sub_group_id null , tpl.vip_seat_id null , tpl.seat_block_section_id null , tpl.is_upsale null bring together `ticket_sub_types` `tst` on tst.ticket_sub_type_id = tpliv.ticket_sub_type_id , tst.status =1 bring together `ticket_sub_type_vendor` `tstv` on tstv.ticket_sub_type_id=tst.ticket_sub_type_id , tstv.status =1 limit 0 , 30
so want execute query 1 if homecoming info null execute query , retrieve data...
is possible handle these queries in 1 query...
i want combine 2 query in 1 query .... next scenario 1) in first query if info (not null) not have check sec query 2) if info null in first query should homecoming info query 2 ... 3) want combine both queries , create 1 query real world scenario ( why can not utilize **(event_id null or event_id = "soem value")** ) -> if "some event_id" 3 rows in homecoming info ->and event_id null 2 rows ... -> in scenario want 3 rows come "some event id" , dont need other data... ->if "some event_id" null info , want utilize query 2 retrieve data..
php mysql select null
No comments:
Post a Comment