Comments (4)
Right now this isn't supported, but could be if a syntax for it can be worked out.
One thought: create a new :select-distinct clause (see honeysql.format/format-clause) that takes two sets of fields: one for the "on" fields, and one for the other fields. E.g.,
{:select-distinct [[:bar] [:foo]]}
or, with a helper defined:
(select-distinct [:bar] [:foo])
from honeysql.
Okay, that's helpful, thanks!
from honeysql.
you can do this now:
(-> (select (sql/call :distinct-on :bar) :foo) (sql/format))
=> ["SELECT DISTINCT ON (bar), foo"]
from honeysql.
SELECT DISTINCT ON (bar), foo
isn't legal in PostgreSQL at least.
from honeysql.
Related Issues (20)
- Review :dialect/:quoted docs -- ensure it's clear that :quoted nil is valid HOT 3
- No way to cast to an array of a specific type without using `:raw`
- Can't specify multiple columns in the `ORDER BY` clause in aggregate functions
- Conditional `WHERE` clauses are hard to write and read HOT 8
- Inconsistent requirements for `:order-by` and `:group-by`
- Facilitate adding SQL keywords in between function arguments HOT 10
- Update docs for single keyword (symbol) uses? HOT 1
- Syntax for expanding records in PostgreSQL HOT 6
- :raw expects a single argument now HOT 1
- Improve exceptions/error reports HOT 2
- Postgres: On conflict update row with values where condition is met reports an error HOT 8
- HoneySQL2 makes all functions calls uppercase HOT 3
- Difficulties in converting documentation examples from hashmap form to helper function form HOT 5
- Postgres upsert support docs miss some of the supported cases
- `format` can emit syntactically invalid AS clauses HOT 1
- Nesting JOINs HOT 11
- Support H2's `TRUNCATE TABLE` syntax HOT 1
- Support for `postgres` "with ordinality" HOT 1
- Support for PostgreSQL interval type
- `:quoted` doesn't work together with `if exists` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from honeysql.