Group by in SQL

F

Francis

need to add a 'select' & 'Group by' statement in excel query.
The Spreadsheet looks like this

KRE001 8/17/2007
KRE001 8/17/2007
WAT001 9/27/2007
WAT001 9/27/2007
TOT001 7/6/2007
KEM001 7/12/2007
CYC001 7/16/2007
CYC001 7/16/2007
MET007 7/16/2007

This is the sql statement.

SELECT V_PO_HISTORY.VENDOR, V_PO_HISTORY.DATE_PO
FROM V_PO_HISTORY V_PO_HISTORY
WHERE (V_PO_HISTORY.DATE_PO>{d '2007-07-01'})

I need to group the vendors in column A.
can someone please help?
 
S

Sylvain Lafontaine

First, this newsgroup is about Access and ADP - which is a type of database
project created by Access and designed to be a frontend to SQL-Server - and
has nothing to do with Excel; so you should post your question to a
newsgroup dedicated to Excel or to Excel queries if you want a more explicit
answer.

In your case, as far as I can remember, the Microsoft Query engine used by
Excel cannot represent graphically a select query with a Group By statement;
so you will have to exit the graphic mode and switch to the text mode (also
known as the sql mode) in order to enter your Group By statement manually.
After that, you won't be able to manipulate your select statement
graphically anymore and any further modifications will have to be done
manually (for this particular query, of course). The same rule apply to the
usage of some other sql statements like the UNION statement.

On how to switch to the text or sql mode, I don't remember. Probably from
the menu or by using the right click of the mouse on either the title bar or
the main body of the Microsoft Query window.
 
F

Francis

appreciate, sorry for inconvenience.

Sylvain Lafontaine said:
First, this newsgroup is about Access and ADP - which is a type of database
project created by Access and designed to be a frontend to SQL-Server - and
has nothing to do with Excel; so you should post your question to a
newsgroup dedicated to Excel or to Excel queries if you want a more explicit
answer.

In your case, as far as I can remember, the Microsoft Query engine used by
Excel cannot represent graphically a select query with a Group By statement;
so you will have to exit the graphic mode and switch to the text mode (also
known as the sql mode) in order to enter your Group By statement manually.
After that, you won't be able to manipulate your select statement
graphically anymore and any further modifications will have to be done
manually (for this particular query, of course). The same rule apply to the
usage of some other sql statements like the UNION statement.

On how to switch to the text or sql mode, I don't remember. Probably from
the menu or by using the right click of the mouse on either the title bar or
the main body of the Microsoft Query window.
 
A

Ad Buijs

MH

Wilt U vanaf nu stoppen met voor mij onbelangrijke en ongevraagde berichten.

Bij voorbaat dank A Buijs.
 

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