(client selectFrom CitySchema where CitySchema.countryId eq
{ this select CountrySchema.id from CountrySchema where CountrySchema.code eq countryCode })
and CitySchema.name contains cityName
Which generate this query:
SELECT cities.id, cities.country_id, cities.state_id, cities.name
FROM cities
WHERE (cities.country_id = (SELECT countries.id FROM countries WHERE (countries.iso2 = $1) ))
AND (cities.name LIKE $2)
However it was nor working, After debugging and found out that the tuple arguments where in the wrong order.
Tuple[0] = "cityName"
Tuple[1] = "countryCode"
As a workaround, I've rewrote the query and now it's working:
(client selectFrom CitySchema where CitySchema.name contains cityName and
CitySchema.countryId eq
{ this select CountrySchema.id from CountrySchema where CountrySchema.code eq countryCode })
I have the following query:
Which generate this query:
However it was nor working, After debugging and found out that the tuple arguments where in the wrong order.
Tuple[0] = "cityName" Tuple[1] = "countryCode"
As a workaround, I've rewrote the query and now it's working: