I need to take find all unique values from the below and pass them to a sql query. Below is an example of what I am trying to do, I am actually taking the data from a two files comapring them and getting the unique values.
My problem is that I want to put the values in a sql IN() clause but I am having trouble comma separating the values
I have tried using replace but that does not seem to work for me
(def snapshot
#{{:id "1234" :mtm "101" :pv"200"}
{:id"1235" :mtm "101" :pv"200"}
{:id"10234" :mtm "101" :pv"200"}
{:id"12034" :mtm "101" :pv"200"}
{:id"127" :mtm "101" :pv"200"}}
)
(def snapshot1
#{{:id"1238" :mtm "104" :pv"200"}
{:id"234" :mtm "101" :pv"200"}
{:id"124" :mtm "101" :pv"200"}
{:id"123" :mtm "101" :pv"200"}
{:id"134" :mtm "101" :pv"200"}}
)
(def SNAPSHOT-IDsT (set (map :id snapshot)))
(def SNAPSHOT-IDsT1 (set (map :id snapshot1)))
(def id-in-one-file-only (difference SNAPSHOT-IDsT1 SNAPSHOT-IDsT))
(println id-in-one-file-only)
this gives me {1238 123 134 234 124}
How can I edit these results to give me {1238, 123, 134, 234, 124}
So that I can then pass it to a string
(str "Select * from table where id in ("id-in-one-file-only")")
Any help or pointers with this would be much appreciated
differencereturns a set, so I assume you have#{1238 123 134 234 124}as a result. How about a format fn: