select distinct u.*, p3.value
from users u
join property p1 on u.id = p1.user_id
join property p2 on u.id = p2.user_id
join property p3 on u.id = p3.user_id
where p1.name = 'admin' and p1.value='false'
and p2.name = 'email' and p2.value like '%mah%'
and p3.name = 'name'
order by p3.value;
from users u
join property p1 on u.id = p1.user_id
join property p2 on u.id = p2.user_id
join property p3 on u.id = p3.user_id
where p1.name = 'admin' and p1.value='false'
and p2.name = 'email' and p2.value like '%mah%'
and p3.name = 'name'
order by p3.value;
Surprisingly this is quite OK, since PostgreSQL won't be stupid enough to do the full Cartesian product.
I love you PosgreSQL.
b.m
ciplogic
0 comentarii:
Post a Comment