How to compare two columns in the same table via the where() function


#1

I am running into a situation where I can’t seem to compare two columns from the same table with the where() function and the lessThan class.

I want to select all the entries in a table where the number of products received is less than the number of products ordered.

here is what I am trying:

                    $where = new Where();
$where->lessThan('K_PRODLTM.PL_QTYRECV', 'K_PRODLTM.PL_QTYORDR', self::TYPE_IDENTIFIER, self::TYPE_VALUE);

If I put in the second column a number, say 100, it works fine.

Thank you for the help!


#2

I assume self::TYPE_VALUE there is why this is happening? Should also be an identifier for the second operand.