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
 General SQL Server Forums
 New to SQL Server Programming
 Transact SQL to be written IMPORTANT

Author  Topic 

shantanu4u
Starting Member

1 Post

Posted - 2008-10-31 : 11:02:55
Hello All
Please help me with the below issues

CUST (Customer Table)

cust_id
cust_typ
desc

KUM-67890
PRI
primary customer

MAHA-540
SEC
secondary customer

ABHI-420
SEC
secondary customer

BHAW-999
SEC
secondary customer


Link table between the customer from above table know as
CUST_REF

Cust_Id_1 Cust_Id_2 Desc
MAHA-540 KUM-67890 ....
ABHI-420 KUM-67890 ....
BHAW-999 KUM-67890 .....

Now we have to insert a link customer so that customers can be grouped together

Example
CUST (Customer Table)
cust_id cust_typ desc
KUM-67890 PRI primary customer
FRIE-67890 FRI friend(link Customer)
DUSH-67890 DUS others(link Customer)
MAHA-540 SEC secondary customer
ABHI-420 SEC secondary customer
BHAW-999 SEC secondary customer

And now the link in the table CUST_REF should be link this
Cust_Id_1 Cust_Id_2 Desc
FRIE-67890 KUM-67890
MAHA-540 FRIE-67890
FRIE-67890 KUM-67890
ABHI-420 DUSH-67890
BHAW-999 FRIE-67890

i have sending the descriptive diagram
example
main cust(KUM-67890)
!---secondary customer( MAHA-540) friend
!---secondary customer(ABHI-420)dusman
!---secondary customer(BHAW-999)dusman
Now i have to group the similar item into one jaise
main cust(KUM-67890)
!---link customer(FRIE-67890)
!---secondary customer(MAHA-540) friend
!---secondary customer(BHAW-999)friend
!---link customer(DUSH-67890)
!---secondary customer(ABHI-420)others



Could you pleae help me to write the above code in Trnsact SQL i am new to it.

Regards
Kumar
[/size=1][/size=1]

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-31 : 11:07:20
what designates who should be linked to DUSH and who to FRIE?
Go to Top of Page
   

- Advertisement -