Master-Detail (2 details)

Master-Detail (2 details)

Post by Bruno » Mon, 28 Feb 2005 04:12:04


Hi!

I have the following master-destails table in my database:

www.virtuasoft.com.br/help.JPG

Please help in the following sqls:

1. How can i create a SQL that returns all the field from both tables? (i
have tried INNER JOIN, but, since Person and Company have different fields,
it doesnt work)
2. How can i create a SQL search both tables for all fields and add a column
telling which table it got the records form (
something like: SELECT *, 'Client' As Type FROM Client INNER JOIN
Person ON Client.PKid = Person.PKid
SELECT *, 'Company' As Type FROM Company
INNER JOIN Person ON Company.PKid = Person.PKid
)

Thanks a lot, Im having a really hard time trying to do it!

Bruno N
 
 
 

Master-Detail (2 details)

Post by Hugo Korne » Wed, 02 Mar 2005 06:46:42


(snip)

Hi Bruno,

Has someone already answered your questions? I don't see any replies,
even though your post is already two days old, but maybe my newsreader
missed some messages?

Annyway, I don't really understand your data and requested output. I
think I'd understand better if you post the CREATE TABLE statements to
create your tables on my system, the INSERT statements to fill them with
some sample data and the output you'd like to get, based on that sample
data. Check out www.aspfaq.com/5006 for more info on how to present your
problem.

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)

 
 
 

Master-Detail (2 details)

Post by --CELKO- » Wed, 02 Mar 2005 23:08:52

Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are. Sample data is also a good idea, along with clear
specifications. Most of us will not jump to a URL provided by a
stranger. And most of us would rather work with DDL instead of a .jpg.
 
 
 

Master-Detail (2 details)

Post by rayda » Wed, 02 Mar 2005 23:20:49


No, this was posted on the 28th but it seems that the poster has a clock
problem.