Last active
December 20, 2015 18:48
-
-
Save alivesay/6178310 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
count(*) | |
FROM | |
public.location_group | |
WHERE | |
port_number = $1 | |
AND ( | |
( | |
is_valid | |
AND id IN ( | |
SELECT | |
location_group_id | |
FROM | |
public.location_group_location | |
WHERE | |
location_id IN ( | |
SELECT | |
id | |
FROM | |
public.location | |
WHERE | |
code IN ( | |
SELECT | |
location | |
FROM | |
record.item_record | |
WHERE | |
record_id IN ( | |
$2, $3, $4, $5, $6, $7, $8, $9, $10, $11 | |
) | |
) | |
) | |
) | |
) | |
OR ( | |
is_valid = false | |
AND id NOT IN ( | |
SELECT | |
location_group_id | |
FROM | |
public.location_group_location | |
WHERE | |
location_id IN ( | |
SELECT | |
id | |
FROM | |
public.location | |
WHERE | |
code IN ( | |
SELECT | |
location | |
FROM | |
record.item_record | |
WHERE | |
record_id IN ( | |
$12, $13, $14, $15, $16, $17, $18, $19, $20, $21 | |
) | |
) | |
) | |
) | |
) | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment