https://kotlinlang.org logo
#exposed
Title
# exposed
m

Miroslav Sobotka

04/19/2021, 7:34 AM
Hello, I have already searched here, but I did not find an answer. How can I build a sql via DSL or Dao that looks like this:
select count(ID) from employer
The ID column is primary key, so uniq and has no nulls.
Employer.slice(Employer.Id).count()
produces
select count(*) from employer
Thanks!
t

tapac

04/19/2021, 4:56 PM
Employer.slice(Employer.Id).selectAll()
m

Miroslav Sobotka

04/19/2021, 5:53 PM
Thank you @tapac! Now I see I made a mistake in the question - I forgot the count(). I want to know how many rows has the table and want to use only the column that have the primary key (not over all with the star). Is there a way to make it?
t

tapac

04/19/2021, 6:03 PM
I think you can try to adjust a query from a wiki
a

aryeh

06/22/2022, 10:40 PM
+1 -- did you figure this out?
6 Views