Here is my request, it is quite simple:
SELECT
INVOICE_ITEMS.II_IVNUM, INVOICE_ITEMS.IIQSHP
FROM
INVOICE_ITEMS
LEFT JOIN
INVOICES
ON
INVOICES.INNUM = INVOICE_ITEMS.II_INNUM
WHERE
INVOICES.IN_DATE
BETWEEN
'2010-08-29' AND '2010-08-30'
;
I have very limited knowledge of SQL, but I'm trying to understand some concepts, such as subqueries and the like. I'm not looking for a redesign of this code, but rather an explanation of why it is so slow (600+ seconds in my test database) and how I can do it faster.
In my opinion, the left join creates a virtual table and populates it with each sequence of results from the join, which means that it processes each row. How can I stop the query from reading the table completely and just find the sentence WHERE/BETWEENand then create a virtual table after that (if possible)?
How is my logic? Are there constantly recommended resources to get SQL ninja status?
: . ODBC , OMNIS. , , , MSSQL.