Below query is used in one of my product. I am not able to understand why 1=1
is mentioned. it is always going to true.
select * from emp;
select * from emp where 1=1;
As per my understanding both are same. What could be the intention of developer to put 1=1
in below query? he can simply write where
condition in one of the and
condition.
SELECT msi.concatenated_segments item_code,
mmt.transaction_date,
mtt.transaction_type_name,
mmt.transaction_quantity,
mcd.prior_cost,
mcd.new_cost
FROM
mtl_cst_actual_cost_details mcd,
mtl_system_items_kfv msi,
mtl_material_transactions mmt,
mtl_COST_types mtt
WHERE 1 = 1 -------------------------------------------------This I am refering
AND mcd.inventory_item_id = msi.inventory_item_id
AND mcd.organization_id = msi.organization_id
AND mcd.transaction_id = mmt.transaction_id
AND mmt.inventory_item_id = msi.inventory_item_id
AND mmt.organization_id = msi.organization_id
AND mmt.transaction_type_id = mtt.transaction_type_id
ORDER BY mcd.creation_date DESC;