New answers tagged

0 votes

Postgres constraints: EXCLUDE (name WITH =) vs partial unique index

exclusionary constraints have indexes whose constraints are deferrable, whereas unique indexes do not
amohr's user avatar
  • 101
0 votes

Select unique rows based on condition stored in another table

Try using DISTINCT ON: SELECT DISTINCT ON (pattern_id) pattern_id, question_id FROM patterns JOIN subchapters USING (pattern_id) JOIN questions USING (chapter_id) ORDER BY ...
Laurenz Albe's user avatar
  • 51.6k
0 votes

Select unique rows based on condition stored in another table

You can use a elaborate JOIN, where you combine all three tables. for the random return you need an CTE to get only one charpter CREATE TABLE Patterns ( "id" VARCHAR(2), "...
nbk's user avatar
  • 8,232

Top 50 recent answers are included