Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-12-19 : 08:54:45
|
| Jason writes "Greetings, mister SQL Guru!My question is in relation to a question Jing posted awhile ago, about a type of relationship referred to as a "subtype" relationship. To refresh your memory, here is an excerpt from his post:--- start of excerpt ---Now I am developing a website through which we can collect data from users into our database(SQL server 7). The idea is the users fill out forms which specify their requests for the products(our company produce valves). Besides the general data, they should also provide the technical information depending on the valve type. There are 2 categories--standard valve and special valve, whose "tech infomation form" comprise different fields. In the database, I've created a table for the general data (table A), 2 tables (table B, C) for technical information (one for each category). In table A there is a field named "valve type" (bit type). Depending on which radio box the user chooses, the following form may be either the form for standard valve, or the other. The key fields for the 3 tables are all called filename. Every record in table A has a corresponding one either in table B (if the valve type is "standard"), or table C (the valve type is "special") --- end of excerpt ---He wanted to know how to represent this relationship in a diagram.The way I'd model that scenario is to make a foreign key in tables B and C relating to the primary key in table A, indicating which basic valve the extended information was for. Hence, my question is, is there a single select statement that can be performed which returns an entire record for a valve, with all of the fields from table A, and either (but not both) of tables B or C? (like an xor, but depending on which one of the tables data is required from.)You can assume there is a bit field in table A to represent the type of valve if necessary. You can also assume my application making the call is robust enough to handle variable field names.If there is a problem with my design that could be mended in order to make this possible, let me know.Thanks in advance for your help!- Jason" |
|
|
|
|
|
|
|