Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: SQL query over a list  (Read 1706 times)

Paul Traut

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
SQL query over a list
« on: July 20, 2017, 04:15:26 PM »
I know that I can run a report with a sql query where i have a LimeReport variable such as
"SELECT * FROM customers WHERE customerID = $V{customerID}"
but is it somehow possible to run a report with a sql query where i have something like
"SELECT * FROM customers WHERE customerID in ($V{customerID_List})"?
I know it works as long as the variable $V{customerID_List} is only one number but if I try it with more comma separated numbers like
$V{customerID_List}=1,3,4 it doesn’t work.
If I type in the numbers directly to the query
"SELECT * FROM customers WHERE customerID in (1,2,4) it works fine.

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 992
    • View Profile
Re: SQL query over a list
« Reply #1 on: July 20, 2017, 08:35:36 PM »
The problem is that the limeport uses bindings to pass parameters and as a result of this "SELECT * FROM customers WHERE customerID in ($V{customerID_List})" will be transformed to "SELECT * FROM customers WHERE customerID in (:customerID_List)".