alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

if conditions in an SQL query ?

if conditions in an SQL query ?

If you must check whether both start_date and end_date are null or not:

 SELECT l.LoginName ,p.name as project_name, p.start_date as 
project_start_date, p.end_date as project_end_date, 
pe.budget, pe.start_date, pe.end_date  
FROM project_expenses_new pe 
INNER JOIN projects p ON  pe.project_uuid=p.uuid 
INNER JOIN LoginUsers l ON pe.employee_uuid=l.uuid 
WHERE pe.employee_uuid='8a373382-c921-11ec-a7c7-005056020962' AND 

'2021-08-01' BETWEEN (case when p.start_date is null or p.end_date is null then 
pe.p.start_date else p.start_date end) and (case when p.start_date is null or p.end_date is null then pe.p.end_date else p.end_dateend);

256 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online