List:General Discussion« Previous MessageNext Message »
From:Imran Date:October 10 2005 7:52pm
Subject:Help on writing a sql statement
View as plain text  
Hi all:

 

I need some help in writing a sql statement.

 

I have three tables (Sales, Cust and Product). The sales table contains a
large volume of data and I want to create a sql to group the sales table
then join the resultant to both the Cust and Prod and to have additional
fields selected from the Cust and Prod.

 

So in effect something like (obviously syntax is wrong)

 

Select sm.prodno, sm.custno, sum(cost) as costs, sum(sales) as sales,
sm.date

from Sales SM where sm.date <= date(‘2005-09-01 00:00:00’) Group by
sm.prodno, sm.custno, sm.date ,

(Select prod.desc, prod.code, cust.custno, cust.name from cust, Prod) left
join sm.prodno = prod.code left join sm.custno=cust.custno) …

 

Any help would be greatly appreciated.


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.14/127 - Release Date: 10/10/2005
 

Thread
Help on writing a sql statementImran10 Oct
Re: Help on writing a sql statementSGreen10 Oct
  • Re: Help on writing a sql statementImran11 Oct
    • Re: Help on writing a sql statementSGreen11 Oct
      • Re: Help on writing a sql statementImran11 Oct
        • Re: Help on writing a sql statementSGreen11 Oct
          • Re: Help on writing a sql statementImran11 Oct
            • Re: Help on writing a sql statementSGreen11 Oct
      • Thank you ... Help on writing a sql statementImran29 Oct