Ajinkya Ban

Ajinkya Ban

  • NA
  • 32
  • 42.6k

Writing query

Mar 19 2013 2:11 AM
i have one problem for writing query my problem is that i want write a query like this
 
in my database there is one main table "Contacts" in that there is two field Category1Code and Category2Code but i want to replace these Code into name.There is table for Category1Code and Category2Code.
 
table structure is like this
"Contacts" 
 
ContactID Category1Code Category2Code FirstName LastName
 
C000001 C1018 C2025 ABC XYZ
 

the category1code table look like this
 
Category1Code CategoryName 
 
C1018 PQR
 

 
the category2code table
 
Category2Code Category1Code Categoryname
C2001 C1018 TTT
 

i want replace these code into its name into Contact table.
Please give query
thnx in advance..
 
Finally i want output like this into Contact table
 
ContactID Category1Code Category2Code FirstName LastName
 
C000001 PQR TTT  ABC  XYZ

Answers (1)