I saw this query, and I'm still not really a pro in PostgreSQL. I want to know what does the .* after the vi and also i see that they rename tables without the as, it works but I wanted to know if its a common practice.
select vi.* , coalesce(ordenes, 0)
from vistas_por_jose vi
left join ventas ve
on vi.store_id = ve.store_id
This select all columns from the
vialias, which is the tablevistas_por_jose. Thus none of thevealias (ventas) will be selected. Unlessordenesis fromventas, at which point it really should be using the alias.