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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 query help-partial comparison?

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2015-02-26 : 11:39:10
Hi friends,

I have a table called Customer with fields as follows

Customer_ID Customer_name Customer_Qname
1 John HA-1
2 Carepenter VG-3
3 Tim V1

ANd then i have a table called CustomerData

RecordID Customer_Client_ID Price
1 HA-1-22r4 8.0

2 VG-3-RR67 9.0

3 V1-fgr4 10.0

I now have added a new field Customer_ID to the CustomerData to map the Cutsomer_ID field data from Customer Table. But the problem is I have to map them by comapring CustomerQname field and
Customer_Client_ID(CustomerQname+some string).
So basically i want to get the CustomerQname and compare with the Customer_Client_ID and if there is match populate my Customer_Id field of the CustomerData table. How can i achieve this partial comaparison ..Thank You

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2015-02-26 : 14:32:58
could you compare Customer_Qname to LEFT(Customer_Client_ID, LEN(Customer_Qname))


djj
Go to Top of Page
   

- Advertisement -