question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding a distinctOn method for cross database distinct values

See original GitHub issue

PostgreSQL - DISTINCT ON (column)

MySQL / SQLite3 - GROUP BY column

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

18reactions
StephanHoyercommented, Jul 7, 2015

This works for me

knex('tablename').distinct(knex.raw('ON (column) column'))
  .orderBy('column')
  .orderBy('another_column');

at least in postgres

16reactions
Znarkuscommented, Nov 14, 2016

Why wontfix? 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL DISTINCT: The Complete Guide
DISTINCT is a keyword in SQL that allows you to show unique or distinct results. It's added to a SELECT query to eliminate...
Read more >
Difference between Unique Values (DISTINCT) and ...
In Microsoft Access queries, use Unique Values property (DISTINCT) if you need a snapshot of certain data, without seeing duplicates in the results....
Read more >
SQL Server SELECT DISTINCT
This tutorial shows you how to use the SQL Server SELECT DISTINCT clause to retrieve the only distinct values in a specified list...
Read more >
PySpark Count Distinct from DataFrame
Another way is to use SQL countDistinct() function which will provide the distinct value count of all the selected columns.
Read more >
What's the Difference Between UNIQUE and DISTINCT in ...
The DISTINCT keyword is used while fetching the result set from the database. It directly follows the SELECT keyword when we want to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found