I'm doing this query and it's picking 'ar' 16, when I've specified to only get 'ar' equal to or less than 3?
SELECT ticket_id, status,targets, ar, create_date FROM tufin_sc_tickets WHERE create_date >= '2022-01-06' AND create_date <= '2022-14-06' AND targets <= '3' AND ar <= '3' AND (status = '0' OR status = '1' OR status = '2' OR status = '3' OR status = '4');
Any ideas why?
CodePudding user response:
I think it's because ar type is text. you have to cast it first. change
AND ar <= '3'
to
AND CAST (ar AS INTEGER) <= 3;