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.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Data Relationship

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-10-21 : 08:48:45
Ann writes "See if you could solve this quite complex (unusual?) problem.
I need to model this data relationship in SQL Server 2000 table/s?

AAA -----> 111
AAA -----> 222
AAA -----> 333
AAA -----> 444
AAA -----> AAA
111 -----> 222
222 -----> 111
111 -----> 111

A real life example: AAA at HQ ordered 4 items, one for his main office and the others for each of his three branch offices. I need to flag AAA as 'billed to' and 'shipped to'. The other three offices (111, 222, 333) need to be flagged as 'shipped to' only.

billed shipped
AAA -----> 111
AAA -----> 222
AAA -----> 333
AAA -----> AAA


Now, branch office 111 placed an order ('billed to') and had it shipped to another branch office 222 ('shipped to') and vice versa. Branch office 111 can also place an order for itself, i.e., it will be flagged as 'shipped to' and 'billed to'.

billed shipped
111 -----> 222
222 -----> 111
111 -----> 111

In other word, a record parent has child records, then a child record becomes a parent of another child record, or single record can be a parent and a child (AAA -----> AAA, BBB---->BBB).

A query to go with the table/s will be nice too. Thank you in advance for you help. Your prompt response is greatly appreciated.

Ann







"

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-10-21 : 08:55:53
Do you get paid to do this ?

Damian
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-10-21 : 11:57:52
I smell homework....

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

Lavos
Posting Yak Master

200 Posts

Posted - 2002-10-21 : 20:21:57
Both of those possibilities are kind of depressing to me.

----------------------
"O Theos mou! Echo ten labrida en te mou kephale!"
Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2002-10-21 : 22:12:49
Assumming that you are saying you have a table with the following data:

Shipped | Billed
AAA 111
AAA 222
AAA 333
111 222
222 111
111 111

What is the question???? Are you asking how to store the data or how to retrieve certain information? If it's the later then what information do you need from the data?

Go to Top of Page
   

- Advertisement -