Skip to main content
Known Participant
October 27, 2006
Question

SQL IN

  • October 27, 2006
  • 3 replies
  • 589 views
The user can select multiple areas, but how can I get the SQL to put them all surrounded by their own single quotes? The code below groups all the values together in one big single quote:

select * from Report7
WHERE facility IN ('#arguments.area#')
    This topic has been closed for replies.

    3 replies

    Inspiring
    October 28, 2006
    Query the tables instead of the view.
    Inspiring
    October 27, 2006
    Perhaps a change of strategy is in order. Do you have a normalized database with numeric primary key fields in every table? "yes" would be a good answer, as long as it's true.
    Ken_F_Author
    Known Participant
    October 27, 2006
    This SELECT statement is querying a SQL View, but yes, all primary key fields are numeric. Is there a way I can replace the commas in the results or do you have a better solution? Thanks!
    Inspiring
    October 27, 2006
    With the listqualify function.
    Ken_F_Author
    Known Participant
    October 27, 2006
    OK, making progress. The code below works. The only problem is that some values have commas, and the list then separates the value into 2 pieces. How can I tell it to ignore special characters in the values?

    WHERE facility in (#listQualify(arguments.facility,"'")#)