Problems with a SQL

F

filo666

Query [de 30 a 60 días] is a query linked to Tables RFC and RSalidas,
RSalidas have the information of the sales in the following format
Date Number product Amount
12/08/05 1121 117 1500
12/08/05 1121 118 100
12/08/05 1121 119 150
12/08/05 1122 17 300
12/08/05 1122 19 50
12/08/05 1123 41 80
13/08/05 1124 15 100
13/08/05 1124 20 100
and so on
I want a report that resume this information in this:
12/08/05 1121 1750
12/08/05 1122 350
12/08/05 1123 80
13/08/05 1124 200

so, The sql I made is: SELECT ([de 30 a 60 días].Number]), sum([de 30 a 60
días]).[Amount]) AS totalconiva, from [de 30 a 60 días], group by ([de 30 a
60 días]).Date;
when runnig query a strange message appears:
"The instruction SELECT includs a reserved word, an argument is missing or
has a spelling mistake, or punctuation signs are incorect (Sorry for the
grammar but it's a traslation from spanish)
What am I doing wrong????
TIA
 
G

George Nicholson

To address Error:
1) SELECT ([de 30 a 60 días].Number])
- should be
SELECT [de 30 a 60 días].[Number]
- is missing a [
- paranthesis can probably be omitted

2) sum([de 30 a 60 días]).[Amount])
- should be
sum([de 30 a 60 días].[Amount])

3) group by ([de 30 a 60 días]).Date;
- should be
group by [de 30 a 60 días].Date;

4) DATE is a reserved word. Sometimes this causes problems, sometimes it
doesn't. Eliminate the possibility. Rename your query field.

Other:
1) You need to add Date (or whatever you are going to call it) to your
SELECT statement if you want it to appear in your output (which you indicate
you do). Having it in the GroupBy clause won't make it appear in your
output.

2) I believe you want to add Number to your GroupBy clause

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top