Skip to content

Fixes query for multi-key primary keys#1

Open
thomaskern wants to merge 1 commit intocolinhowe:masterfrom
thomaskern:master
Open

Fixes query for multi-key primary keys#1
thomaskern wants to merge 1 commit intocolinhowe:masterfrom
thomaskern:master

Conversation

@thomaskern
Copy link

Adding parentheses to the WHERE clauses allows the usage of multi-column
primary keys/foreign keys.

E.g.: columns aid and aid2 are the primary keys and are queried in the
foreign table.

SELECT * FROM tabA WHERE aid = 5 AND aid2 = 7 OR aid = 5 AND aid2 = 8 OR
aid=9 AND aid10;

The parentheses fixes this:

SELECT * FROM tabA WHERE (aid = 5 AND aid2 = 7) OR (aid = 5 AND aid2 = 8) OR
(aid=9 AND aid10);

Adding parentheses to the WHERE clauses allows the usage of multi-column
primary keys/foreign keys.

E.g.: columns aid and aid2 are the primary keys and are queried in the
foreign table.

SELECT * FROM tabA WHERE aid = 5 AND aid2 = 7 OR aid = 5 AND aid2 = 8 OR
aid=9 AND aid10;

The parentheses fixes this:

SELECT * FROM tabA WHERE (aid = 5 AND aid2 = 7) OR (aid = 5 AND aid2 = 8) OR
(aid=9 AND aid10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant