我該如何使用連接編寫此查詢?我試圖去做,但它不起作用。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