Subject | Re: [firebird-support] Non-correlated subquery is really slow |
---|---|
Author | PenWin |
Post date | 2011-02-18T09:46:15Z |
Dne 18.2.2011 10:33, kokok_kokok napsal(a):
FROM customers c
LEFT JOIN orders o ON o.customer=c.id
GROUP BY 1, 2
Pepak
> How can I rewrite a non-correlated subquery to improve the performance?SELECT c.id, c.name, COUNT(DISTINCT o.id)
>
> For example:
>
> SELECT
> (SELECT COUNT(*) FROM Orders) AS TotalOrders,
> Name
> FROM Customers
FROM customers c
LEFT JOIN orders o ON o.customer=c.id
GROUP BY 1, 2
Pepak