https://kotlinlang.org logo
g

galex

03/06/2019, 7:46 AM
How do I query table B to count how many rows have my id from Table A? Basically a calculated field based on another select?
t

tapac

03/06/2019, 12:16 PM
Could you express it with a plain sql?
g

galex

03/06/2019, 4:01 PM
Yes, something like “Select count(*) as countStuff from TableB b where b.id = a.id” inside another query
t

tapac

03/07/2019, 8:26 AM
Copy code
TableA.innerJoin(TableB, { TableA.id }, { TableB.id }).
   slice(TableA.id.count()).
   selectAll()
?
g

galex

03/07/2019, 2:44 PM
I will try that, thanks
3 Views