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
 USING LEN

Author  Topic 

dotman
Starting Member

5 Posts

Posted - 2008-10-28 : 08:20:30
Hi,

At present I have the following, 2 fields from 1 table and a 3rd field which is the 2nd field with a digit removed from the end.

SELECT TRANS1, TRANS2, LEFT(TRANS2,7) AS TRANS_REF
FROM TRANS

RESULTS
TRANS1 | TRANS2 | TRANS_REF

Question.... How do I now use TRANS_REF to join to a field 'TRANS_REF' in a new table called 'REFUNDS' ???

I've tried the normal Inner join which I use successfully elsewhere but having no joy on this!

Any help appreicated!

dotman

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-28 : 08:27:16
[code]SELECT fields...
FROM
(
your query here
)t
JOIN REFUNDS r
ON r.field=t.TRANS_REF
...
[/code]
Go to Top of Page
   

- Advertisement -