我该如何使用连接编写此查询?我试图去做,但它不起作用。PostgreSQL:如何使用连接编写查询?
select fund.fundname, sum(shares) as tt, (sum(shares)*price.price) as value
from trans, fund, customer, price
where trans.fundid = fund.fundid
and trans.transdate = '2009-1-1'
and price.fundid = trans.fundid
and price.pricedate = trans.transdate
and trans.sin = customer.sin
and customer.name = 'Jacob'
group by fund.fundname, price.price;
感谢
这是连接,甚至三个。可能甚至是交叉连接。你有什么尝试,为什么没有工作?错误讯息? – stefan