i have some query
SELECT COUNT(loan_payment) as setcolumn
FROM table1
WHERE paydate between {d '2020-05-01'} AND {d '2020-05-31'}
and period_code = 'MONTHLY'
AND company_id = 11111
AND ( emp_id IN ('DO2071406','DO2073897','DO2073464','DO2071522',
'DO2071400','DO2071401','DO2071402','DO2071403','DO2073538',
'DO2074215','DO2074233','DO2070850','DO2071618','DO2070442',
'DO2071741','DO2071739','DO2071740','DO2071751')
OR emp_id IN ('DO2071406','DO2073897','DO2073464','DO2071522',
'DO2071400','DO2071401','DO2071402','DO2071403','DO2073538',
'DO2074215','DO2074233','DO2070850','DO2071618','DO2070442',
'DO2071741','DO2071739','DO2071740','DO2071751')OR emp_id IN ('DO2071406',
'DO2073897','DO2073464','DO2071522','DO2071400','DO2071401',
'DO2071402','DO2071403','DO2073538','DO2074215','DO2074233',
'DO2070850','DO2071618','DO2070442','DO2071741','DO2071739',
'DO2071740','DO2071751')OR emp_id IN ('DO2071406','DO2073897',
'DO2073464','DO2071522','DO2071400','DO2071401','DO2071402',
'DO2071403','DO2073538','DO2074215','DO2074233','DO2070850',
'DO2071618','DO2070442','DO2071741','DO2071739','DO2071740',
'DO2071751'
)
when i running i got error message like this
this is a limitation from where in () condition ??
because previously i put all emp_id like this
SELECT COUNT(loan_payment) as setcolumn
FROM table1
WHERE paydate between {d '2020-05-01'} AND {d '2020-05-31'}
and period_code = 'MONTHLY'
AND company_id = 11111
AND ( emp_id IN ('DO2071406','DO2073897','DO2073464','DO2071522',
'DO2071400','DO2071401','DO2071402','DO2071403','DO2073538',
'DO2074215','DO2074233','DO2070850','DO2071618','DO2070442',
'DO2071741','DO2071739','DO2071740','DO2071751','DO2071406',
'DO2073897','DO2073464','DO2071522','DO2071400','DO2071401',
'DO2071402','DO2071403','DO2073538','DO2074215','DO2074233',
'DO2070850','DO2071618','DO2070442','DO2071741','DO2071739',
'DO2071740','DO2071751','DO2071406','DO2073897','DO2073464',
'DO2071522','DO2071400','DO2071401','DO2071402','DO2071403',
'DO2073538','DO2074215','DO2074233','DO2070850','DO2071618',
'DO2070442','DO2071741','DO2071739','DO2071740','DO2071751',
'DO2071406','DO2073897','DO2073464','DO2071522','DO2071400',
'DO2071401','DO2071402','DO2071403','DO2073538','DO2074215',
'DO2074233','DO2070850','DO2071618','DO2070442','DO2071741',
'DO2071739','DO2071740','DO2071751')
i got some error message.
Best Answer
OR
does not optimize well; don't use that form.One of these indexes will be optimal; add both:
{d '2020-05-01'}
can be simply'2020-05-01'
You might find this easier to deal with
COUNT(loan_payment)
checks forNULL
; perhaps you want simplyCOUNT(*)
?