Group by in SQL

  • Thread starter Thread starter Francis
  • Start date Start date
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?
 
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.
 
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.
 
MH

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

Bij voorbaat dank A Buijs.
 
Back
Top