Published on InterSystems Developer Community (https://community.intersystems.com)

Home > SQL Query Help in $ListGet

Question
Virat Sharma · Jan 30, 2023

SQL Query Help in $ListGet

Hi All,

I want to run an SQL like below

Select ID,Rollno,Marks,Name,Section,Teacher from Marks left outer join Student on Marks.StudentID=Student.ID

Now, the Student.ID is having the encrypted value which is not matching with Marks.StudentID (as this is clear value).

I can get the clear value using encrypted value as follow

^StoreValue("EncryptStudentID",Student.ID)=$LB("123"). That 123 is the clear Student.ID which I need to match in SQL query (ON clause).

Now I Need to fetch the data from sql query matching both clear values. Something like this

 

Select ID,Rollno,Marks,Name,Section,Teacher from Marks left outer join Student on Marks.StudentID=$LISTGet("EncryptStudentID",Student.ID). But this is giving me error. Is this possible to match the data using sql query or do we need to write an utility only ?

#SQL #Caché
Product version: Caché 2014.1

Source URL:https://community.intersystems.com/post/sql-query-help-listget