Re: Join to one of two tables (based on a value in the source table)
From: Joe Celko (jcelko212_at_earthlink.net)
Date: 08/23/04
- Next message: Joe Celko: "Re: dates in sql"
- Previous message: Mary Chipman: "Re: Help with MS Access Error Trap"
- In reply to: Scott Lyon: "Join to one of two tables (based on a value in the source table)"
- Next in thread: Scott Lyon: "Re: Join to one of two tables (based on a value in the source table)"
- Reply: Scott Lyon: "Re: Join to one of two tables (based on a value in the source table)"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 23 Aug 2004 08:34:37 -0700
>> .. bit .. uniqueidentifier .. table1 and table2 do not have the same
structure .. fields .. I want to do a select from tableSource, that will
join to table1 or table2 .. depending on whether chooseTable is 0 or 1
. VARCHAR(50). <<
Okay, you want to use an assembly language level bit construct to give
yourself a query that returns apples or octopi.
Have you asked yourself just what this kind of query would mean in a
data model? If it is meaningful, then this attribute is split over two
tables and you have some serious design problems. If it is not
meaningful, then you have some serious programming problems.
Since you mention having a uniqueidentifier and VARCHAR(50) columns,
this looks like an ACCESS port in which no redesign work was done.
While it is possible that something is really VARCHAR(50), 80-90% of the
time I find this is the quickie kludge of a newbie, so my warnign light
goes on.
What are you trying to do? You have told us HOW you want to do it.
Where is the DDL?
--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- Next message: Joe Celko: "Re: dates in sql"
- Previous message: Mary Chipman: "Re: Help with MS Access Error Trap"
- In reply to: Scott Lyon: "Join to one of two tables (based on a value in the source table)"
- Next in thread: Scott Lyon: "Re: Join to one of two tables (based on a value in the source table)"
- Reply: Scott Lyon: "Re: Join to one of two tables (based on a value in the source table)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|