value | NameOfField |
---|---|
1 | SlNo |
10/3/21 | ManfDate |
2 | SlNo |
NULL | ManfDate |
3 | SlNo |
11/3/21 | ManfDate |
My current sqlite query structure-
SELECT printf ("Item_No: %s Manufacturing_Date:%s ",(SELECT val from Orders WHERE name='Slno'),(SELECT val from Orders WHERE name='ManfDate') )
This gives output-
Item_No:1 Manufacturing_Date:10/3/21
**Item_No:2 Manufacturing_Date:**
Item_no:3 Manufacturing_Date:11/3/21
I want to modify the sqlite printf statement such that the field name doesn't print when the corresponding value is null.i.e.
Output should look like-
Item_No:1 Manufacturing_Date:10/3/21
**Item_No:2**
Item_no:3 Manufacturing_Date:11/3/21
I have been trying this using IFNULL,IS NOT NULL, EXISTS,CASE etc but nothing seems to work for me. Will be thankful for any help