where
b.deviceId=device_id_U
and(
CONCAT('%',COALESCE(device_id_U,''),'%') and
b.searchTerm like
CONCAT('%',COALESCE(search_term,''),'%') and
b.deviceName like
CONCAT('%',COALESCE(device_name,''),'%') and
b.deviceNumber like
CONCAT('%',COALESCE(device_Number,''),'%') and
b.os like
CONCAT('%',COALESCE(device_os,''),'%') and
b.deviceWorkingStatus like
CONCAT('%',COALESCE(device_workingstatus_U,''),'%') and
b.status like
CONCAT('%',COALESCE(device_status_U,''),'%') )
;
end if;
END
This is my Procedure i want when i pass device_id null then it should ignore where condition with device id and if give device_id value then it should search device id wise please tell me how add dynamically where condition so that i can solve this issue i am facing problem to add where clause dynamically
您可以尝试使用@FDavidov的想法进行反转吗
where b.deviceId= IFNULL(device_id_U , b.deviceId)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.