I am joining two table based on a partial match of data. The data is
for our school's terms/semesters and the courses for those terms. My
query works fine, as far as I can tell. I just want to make sure
someone else doesn't see anything wrong with my solution.
One table has values such as:
2008/FA
2009/FA
2009/SP
2010/SP
The other table has values such as:
ACCT-150-01.2008FA.4310
ACCT-210-01.2008FA.4312
ACCT-210-02.2008FA.4313
ACCT-210-03.2008FA.4314
ACCT-211-01.2008FA.4315
I want to use the first table to control which terms are returned from
the second table. Here is my SELECT statement.
SELECT
cm.course_name
,cm.course_id
FROM
Course_Main cm
INNER JOIN vTermsFromNow tfn
ON cm.course_id LIKE '%.' + REPLACE(tfn.terms_id, '/', '') +
'.%'
First, I remove all slashes. Then, I build a wildcard expression.
Essentially, the SELECT statement would look like:
SELECT
cm.course_name
,cm.course_id
FROM
Course_Main cm
INNER JOIN vTermsFromNow tfn
ON cm.course_id LIKE '%.2008FA.%'
The terms table is on SQL 2005. It is server-linked to the courses
table on SQL 2000. I only have about 6000+/- courses and a dozen terms.
The query will only return 1200+/- records at any time.
As I said earlier, it works, but is there something I'm missing?
Thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312380
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4