query problem with Access database

H

HuskerGrad

Hi,

I am writing a Java application that uses an Access database. I have
the following query that has mulitple joins and a sum on one of the
fields:

Select a.date, b.name, sum(c.score) as total
from (table1 as a,
inner join table2 as b on a.person_id = b.id)
inner join table3 as c on a.game_id = c.id
group by a.date, b.name

If I run the query in Access, it works fine, but from within the Java
code, I get the SQLException "You tried to execute a query that does
not include the specified expression 'DATE' as part of an aggregate
function."

Any help would be greatly appreciated.

Jeff
 
D

David Segall

HuskerGrad said:
Hi,

I am writing a Java application that uses an Access database. I have
the following query that has mulitple joins and a sum on one of the
fields:

Select a.date, b.name, sum(c.score) as total
from (table1 as a,
inner join table2 as b on a.person_id = b.id)
inner join table3 as c on a.game_id = c.id
group by a.date, b.name

If I run the query in Access, it works fine, but from within the Java
code, I get the SQLException "You tried to execute a query that does
not include the specified expression 'DATE' as part of an aggregate
function."

Any help would be greatly appreciated.

Jeff
 
D

David Segall

HuskerGrad said:
Hi,

I am writing a Java application that uses an Access database. I have
the following query that has mulitple joins and a sum on one of the
fields:

Select a.date, b.name, sum(c.score) as total
from (table1 as a,
inner join table2 as b on a.person_id = b.id)
inner join table3 as c on a.game_id = c.id
group by a.date, b.name

If I run the query in Access, it works fine, but from within the Java
code, I get the SQLException "You tried to execute a query that does
not include the specified expression 'DATE' as part of an aggregate
function."

Any help would be greatly appreciated.
DATE is a reserved word in SQL. Try changing the name of this column.
 
S

Sem

DATE is a reserved word in SQL. Try changing the name of this column.- Hide quoted text -

- Show quoted text -

One of the thing you have to becareful is the syntax
ie the use of " and '
these make difference in your code
do first select and then you can do the other with the same pattern
Good luck

-sem
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top