Anand Anand - 7 months ago 8
SQL Question

get the data which are partially filled data in mysql

i have table

output
data are

id q1_ans q2_ans q3_ans
1. '100' 'Nokia' 'abc'
2. 'IPhone' 'def'
3. '300' 'Samsung' 'ahk'
4. '' '' ''


I required only partially filled data like data of id '2'

Answer
select q1_ans, q2_ans, q3_ans FROM table WHERE 
    q1_ans='' OR q2_ans='' OR q3_ans='' 
    AND NOT (q1_ans='' AND q2_ans='' AND q3_ans='');
Comments