Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / February 2008

Tip: Looking for answers? Try searching our database.

Group By in SQL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Francis - 11 Feb 2008 14:23 GMT
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?
ilia - 11 Feb 2008 17:39 GMT
You need a total field of some kind... the only thing I can think of
is count of date?

SELECT V_PO_HISTORY.VENDOR, Count(V_PO_HISTORY.DATE_PO) AS MyCount
FROM V_PO_HISTORY GROUP BY V_PO_HISTORY.VENDOR;

Perhaps you mean consolidating unique records?  In which case, use the
DISTINCT keyword:

SELECT DISTINCT V_PO_HISTORY.VENDOR, V_PO_HISTORY.DATE_PO FROM
V_PO_HISTORY;

> need to add a 'select' & 'Group by' statement in excel query.
> The Spreadsheet looks like this
[quoted text clipped - 17 lines]
> I need to group the vendors in column A.
> can someone please help?
Francis - 11 Feb 2008 18:28 GMT
SELECT DISTINCT works in this case. Thank you very much.

> You need a total field of some kind... the only thing I can think of
> is count of date?
[quoted text clipped - 29 lines]
> > I need to group the vendors in column A.
> > can someone please help?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.