Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3458

Re: Retrieving a value from another table based on a LEFT function?

$
0
0

Thanks to both for your response, you're both really helpful. I'm struggling to get this working though, can I just check my understanding of the code? Apologies for this, I'm pretty new to Crystal and pretty new to SQL - not a great combination!

 

Select cc1.Description Part1,

cc2.Description Part2

 

From Invoice I

  left join Cost_Code cc1

    on cc1.Type = 'P1'

    and Left(i.Cost_Code, 5) = cc1.Cost_Code

  left join Cost_Code cc2

    on cc2.Type = 'P2'

    and Right(i.Cost_Code, 6) = cc2.Cost_Code

 

 

In a few places in the code you've put cc1 and cc2 - is this to represent the table name, or is it a variable name? You've also got the letter i in the Left code in lower case, and in upper case after 'From invoice' - again, is this a table or field name, or is it a variable name?


Viewing all articles
Browse latest Browse all 3458

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>