i have the following where clause which was created by my predecessor and i wonder if there was a better way to write this since all these OR are not very efficient:
a.charge_id = c.bewertungsart_id and
a.bewertungstyp_id != ' ' and
a.chargenpflicht_Kz = ' '
c.bewertungsart_id = ' ' and
a.bewertungstyp_id = ' ' and
a.chargenpflicht_Kz = 'X'
a.bewertungstyp_id != ' '
and a.chargenpflicht_Kz = 'X'
and a.Bewertungsart_ID = c.Bewertungsart_ID
and a.Bestand_Id in ('MCHB','MSKA')
a.Chargenfuehrung_Kz = ' '
and c.bewertungsart_id = ' '
and a.Bestand_Id in ('MARD','MSKA')
The only things i could think of:
- replacing the strings with a bit fields for these true/false checks
- i attempted something trying to compare it to hardcoded strings an in (...)
But it doesnt produce the same result i guess he has some issues with the empty strings, not sure if it would be faster in the first place
(a.Chargenfuehrung_Kz = ' 'and c.bewertungsart_id = ' ' and a.Bestand_Id in ('MARD','MSKA'))
a.Chargenfuehrung_Kz+c.bewertungsart_id+a.Bestand_Id in (' MARD',' MSKA')
I wonder if there is better way to write all this OR statements
I wanna be the very best
Like no one ever was