C
Christopher Glaeser
Consider the following:
tblWorkOrders
WorkOrderID Primary Key
WorkOrderTypeID Foreign Key
[many other fields]
tblWorkOrderTypes
WorkOrderTypeID Primary Key
WorkOrderType Text
1 Inspection
2 Repair
3 Replacement
Question: When designing a query to find all WorkOrders that are Repairs, is
it good practice and will it improve performance to compare WorkOrderTypeID
to the number 2 (which assumes the ordering of WorkOrderTypes is fixed), or
is it better to do the string compare looking for the string "Repair"? I'm
guessing the latter is easier to read and less error prone, but has
performance implications.
Best,
Christopher
tblWorkOrders
WorkOrderID Primary Key
WorkOrderTypeID Foreign Key
[many other fields]
tblWorkOrderTypes
WorkOrderTypeID Primary Key
WorkOrderType Text
1 Inspection
2 Repair
3 Replacement
Question: When designing a query to find all WorkOrders that are Repairs, is
it good practice and will it improve performance to compare WorkOrderTypeID
to the number 2 (which assumes the ordering of WorkOrderTypes is fixed), or
is it better to do the string compare looking for the string "Repair"? I'm
guessing the latter is easier to read and less error prone, but has
performance implications.
Best,
Christopher