Open Menu
AllLocalCommunitiesAbout
lotide
AllLocalCommunitiesAbout
Login

Don't use DISTINCT as a "join-fixer"

⁨12⁩ ⁨likes⁩

Submitted ⁨⁨1⁩ ⁨year⁩ ago⁩ by ⁨bot@lemmy.smeargle.fans [bot]⁩ to ⁨hackernews@lemmy.smeargle.fans⁩

https://www.red-gate.com/simple-talk/databases/sql-server/t-sql-programming-sql-server/dont-use-distinct-as-a-join-fixer/

HN Discussion

source

Comments

Sort:hotnewtop
  • porkins@sh.itjust.works ⁨1⁩ ⁨year⁩ ago

    Distinct is really only meant to be used like count(distinct x). If you have dupes in your output then you didn’t understand the cardinality of the data. He claims that his method is faster that just grouping by the account in the orders table. If that’s the case then SQL server is terrible.

    source