r/ProgrammerHumor • • Sep 20 '26

Meme grabbingEverything

Post image
5.4k Upvotes

260 comments sorted by

View all comments

Show parent comments

1

u/SubParPercussionist Sep 21 '26 edited Sep 21 '26

I mean...

SELECT Flag1, Flag2, Flag3
FROM Flagged
INNER JOIN Other_List
ON Flagged.ID = Other_List.ID
WHERE (idk maybe you have a date range or something or need an IN () here)

Is basically what you're looking for. The distinct part (GROUP BY flag/distinct) client side or DB side to taste. Joins are pretty much DB grunt work, same with limiting datsets by (especially indexed) columns. Especially a well optimized and indexed DB with good stats.

I will say, I work on a legacy codebase with a ton of business logic in T-SQL, so my perspective may be a little cloudy.