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.
| Author |
Topic |
|
a.ashabi
Posting Yak Master
117 Posts |
Posted - 2008-09-18 : 04:00:38
|
| Hi.I've wrote these 2 queries:SELECT a.product_id AS Expr1FROM dbo.tbl_product_vendor a INNER JOINdbo.name$ b ON a.vendor_code = b.product_vendor_code AND a.vendor_code = b.product_vendor_codeANDSELECT product_id AS Expr1FROM dbo.tbl_product_vendorWHERE (vendor_code IN(SELECT product_vendor_codeFROM name$))I didnt get any errors,but the result is not what I want because the vendor_code values on tbl_product_vendor its not excatly match with the values on name$.product_vendor_code.for instance:tbl_product_vendor.vendor_code = 'BL3300B.432'but name$.product_vendor_code = 'BL3300B'which means the values on tbl_product_vendor.vendor_code contains the values on name$.product_vendor_code (values on vendor_code have some more letters than values on product_vendor_code)I thought about adding LIKE for tbl_product_vendor.vendor_codebut I dont know how.would u please help me with that?thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-18 : 04:53:13
|
| SELECT a.product_id AS Expr1FROM dbo.tbl_product_vendor a INNER JOINdbo.name$ b ON a.vendor_code like b.product_vendor_code+'%' AND a.vendor_code = b.product_vendor_codeMadhivananFailing to plan is Planning to fail |
 |
|
|
a.ashabi
Posting Yak Master
117 Posts |
Posted - 2008-09-18 : 14:09:30
|
| thanks a lot u gave me the hint & I did it this way:SELECT dbo.tbl_product_vendor.product_id AS Expr1FROM dbo.tbl_product_vendor CROSS JOIN dbo.name$WHERE (dbo.tbl_product_vendor.vendor_code LIKE '%' + dbo.name$.product_vendor_code + '%')It worked.thanks a lot |
 |
|
|
|
|
|