This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Hey guys i guess i'm just dumb 😄 but how do i use next.jdbc with in in
query something like (jdbc/execute! db ["SELECT * FROM companies WHERE feedname = 'indeed' AND city in ? LIMIT ? OFFSET ?" cities-in-radius limit offset])
can you give a row of data from your companies table and a query that you'd expect to return that row? it appears like cities-in-radius has shape different than column city. i'd expect this to work for something like city in ["one city" "another city"], but your city-in-radius is probably a single number that limits how far from current location you want to search for cities
yeah i managed it with doing something like WHERE location IN (?)
and gave the ?
as joined string. So (str/join ", " cities)
so its location that has City1, city2, city3
and my data i have is city4, city2, city8
and it should match when one city is equal so basically an intersection
Yeah i'm currently searching 😄 there is an intersection command BUT its just for joining two tables 😕
ok found a poor mans solution 😄 i create the query on my own with locate and map through my list and see if one value of my list can be located in the string from the location field.
like this
[(str "SELECT * FROM companies WHERE feedname = 'indeed' AND "
(->>
cities-in-radius
(map #(str "LOCATE('" % "', location) > 0"))
(str/join " OR "))
" LIMIT ? OFFSET ?") limit offset]
I know this is not save for sql injection BUT the city values come from another location table and is not modifyable by a user