Closed afandian closed 6 years ago
Entity fields defined for entity are always included which means you need to either change the entity definition or not use the entity for this query. You can use the table name (as keyword), no need to define entity for it:
(k/select :my-table
(k/modifier "DISTINCT")
(k/fields :a :b))
As this is expected behavior and no further comment has been made, I'm going to close this issue.
This shares some features with issue #251 .
I have a table
my-table
which I normally want to select all fieldsa
,b
,c
,d
from.Now I want to find distinct
:a
and:b
s:SELECT distinct a, b FROM my_table;
But this doesn't work because I can't restrict my fields.
Notice the repeated
a
andb
.I think the suggested behaviour is to remove
c
andd
fromdefentity
, but they are standard fields that should be in thedefentity
and I don't want to have to re-write every other query to put the fields back in.It seems like Korma doesn't allow me to write this query. Have I understood this correctly? My alternatives are a separate
defentity
, which feels like the wrong thing to do, or to write SQL.