4
如果我有兩張表(客戶和訂單),並且我想查看客戶的最新訂單,那麼我將如何使用GQL在Google App Engine上執行此操作?在Google App Engine上,我將如何查看GQL客戶的最新訂單?
通常,我會通過訂單表中存在的外鍵customer_id將這兩個表連接起來。
select orders.* from customers, orders
where customers.customer_id = orders.customer_id
and orders.order_id = (select top 1 sub_orders.order_id from orders sub_orders
where sub_orders.customer_id = orders.customer_id
order by sub_orders.order_date desc)
但是,由於Google App Engine似乎無法加入聯盟,因此我不確定如何解決此限制。任何建議,將不勝感激。
哇!這太棒了!謝啦。 – 2009-05-23 21:56:45