#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 175
Default Group By in SQL

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?

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 256
Default Group By in SQL

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;



On Feb 11, 9:23 am, Francis wrote:
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?


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 175
Default Group By in SQL

SELECT DISTINCT works in this case. Thank you very much.

"ilia" wrote:

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;



On Feb 11, 9:23 am, Francis wrote:
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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Data from One Group of Cells to Another Group Alan Auerbach Charts and Charting in Excel 2 May 27th 07 04:12 PM
I wish to group my worksheets under group tabs CSI Excel Worksheet Functions 5 October 19th 06 09:25 PM
How can I convert a group of numbers to a group of letters? CarlG Excel Worksheet Functions 9 August 18th 06 03:31 PM
Taking age group Ie ages 20-29 and picking out net sales for group viabello Excel Worksheet Functions 1 April 25th 06 04:19 AM
How do I group worksheets (Lotus 123 function is "Sheet>Group Shee jaking Excel Worksheet Functions 2 August 30th 05 02:09 PM


All times are GMT +1. The time now is 05:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"