Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT *
- FROM(SELECT p.id "pond", count(p.id) "liczba"
- FROM ducks d left join ponds p on d.pond_id = p.id left join species s on s.id = d.species_id
- where (temp_preferences = '+' and temp_limit>=temperature) or (temp_preferences = '-' and temp_limit<=temperature)
- group by p.id) as tab
- order by pond;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement