Home > Back-end >  MYSQL - is there any option to get the right condition? Both are not get the right results
MYSQL - is there any option to get the right condition? Both are not get the right results

Time:03-08

SELECT cstmr_type FROM add_vehicle
WHERE cstmr_type = 'Visitor' AND cstmr_type = 'Hospital';

SELECT cstmr_type FROM add_vehicle
WHERE cstmr_type = 'Visitor' & 'Hospital';

CodePudding user response:

Try using IN keyword

SELECT cstmr_type FROM add_vehicle WHERE cstmr_type IN ('Visitor', 'Hospital')

CodePudding user response:

The same row can't have 2 values for the same column I suspect that you mean OR

SELECT cstmr_type FROM add_vehicle
WHERE cstmr_type = 'Visitor' OR cstmr_type = 'Hospital';
  • Related