Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Another SQL Otimization if posible
Message
 
To
09/11/2005 17:36:13
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01066992
Message ID:
01066998
Views:
17
   ** Put all non agregated fields in GROUP BY to not have problems with SET ENGINEBEHAVIOUR
   ** Don't use ALLTRIM()
   SELECT products.prodid,;
          product.name,;
          product_price,;
          SUM(NVL(bill_items.qty,0)) AS OQty,;
          SUM(NVL(input_items.qty,0) AS IQty;
     FROM products;
     LEFT JOIN bill_items  ON product.prodid == bill_items.prodid;
     LEFT JOIN input_items ON product.prodid == input_items.prodid;
     GROUP BY products.prodid,product.name, product_price;  
     ORDER BY products.prodid ;
INTO CURSOR output1
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform