Depending on what you need, a combination of sub queries and joins might the best solution. Use a series of sub queries to select and fine tune the primary keys of the main table with a final query that consists of the join to display the data. This way your not linking everything together first and then doing a where to fine tune,
George > On Dec 5, 2013, at 8:17 PM, "Bryan Stevenson" <[email protected]> > wrote: > > > + 1 for the join....it's the caffeine IMHO ;-) > > *Bryan Stevenson*B.Comm. > President & CEO > Electric Edge Systems Group Inc. - makers of FACTS^(TM) > phone: 250.480.0642 > cell: 250.920.8830 > e-mail: [email protected] <mailto:[email protected]> > web: www.electricedgesystems.com <http://www.electricedgesystems.com> > and www.fisheryfacts.com <http://www.fisheryfacts.com> > > ------------------------------------------------------------------------ > > Please consider the environment before printing this e-mail > > -----CONFIDENTIALITY------ > This message, including any attachments, is confidential and may contain > information that is privileged or exempt from disclosure. It is intended > only for the person to whom it is addressed unless expressly authorized > otherwise by the sender. If you are not an authorized recipient, please > notify the sender immediately and permanently destroy all copies of this > message and attachments. >> On 13-12-05 05:04 PM, Michael Dinowitz wrote: >> I've got an applicant table that including an ethnicity id. I need to >> convert the id into a text value from a separate ethnicity lookup table >> (with less than 10 entries). I can: >> 1. Do a subquery against the ethnicity table in the select part of the >> query and alias the return value >> 2. Do a join to the ethnicity table >> >> My tests on SQL 2008 show that the subquery can run into some wait time on >> the server and seems to be slower and less efficient. This leads me to >> think that using a join is the best idea. Would this be the general >> consensus? Somehow joining to a lookup table feels wrong, but that might >> just be the caffeine. :) >> >> Thanks > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/sql/message.cfm/messageid:3521 Subscription: http://www.houseoffusion.com/groups/sql/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/sql/unsubscribe.cfm
