Home > database >  Please write a SQL query no right answer questions id
Please write a SQL query no right answer questions id

Time:09-27

Try option in table t_ems_item_option item_id questions id, option_id option id, whether is_correct
the right answerFor example,

Item_id option_id is_correct

Questions 1 a f
Item 1 b f
Questions 1 c f
Questions 1 d t

Item 2 a f
Item 2 b f
Questions 2 c f
Questions 2 d f


Please find questions 2

CodePudding user response:

 select distinct item_id from t_ems_item_option 
Where item_id not in (select item_id from t_ems_item_option where is_correct=true)

CodePudding user response:

The select item_id
The from t_ems_item_option
Where item_id not exists
(select item_id from t_ems_item_option where is_correct=true)
Group by 1;
  • Related