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 vi alias, which is the table vistas_por_jose . Thus none of the ve alias (ventas ) will be selected. Unless ordenes is from ventas, at which point it really should be using the alias.