1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 21:34:03 +00:00
laravel-tips/content/tips/use-the-with-ties-clause-to-return-more-than-the-limit-ed-amount-when-there-are-multiple-results-with-the-same-value.md
2022-02-28 12:25:21 +01:00

739 B
Raw Blame History

title tweet_id thread_slug author_username images created_at slug
Use the `WITH TIES` clause to return more than the `LIMIT`-ed amount when there are multiple results with the same value 1498010794155380736 weekly-thread-2022-08 tobias_petry
https://pbs.twimg.com/media/FMSIa6kXsAQ2Axf.jpg
2022-02-27T19:02:59+00:00 use-the-with-ties-clause-to-return-more-than-the-limit-ed-amount-when-there-are-multiple-results-with-the-same-value

Database Tip

Everyone knows the LIMIT clause. But what do you do if you want to have e.g. the employees with the TOP 3 salaries and not exclude the 4th or 5th one earning the same as the 3rd? The WITH TIES clause can return more results if the value is the same. Great!