473,385 Members | 1,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

GroupBy Help

Hi this is my query

Expand|Select|Wrap|Line Numbers
  1. SELECT OrderDetail.OrderDate, OrderDetail.RouteNo, OrderDetail.CustomerNo
  2. FROM OrderDetail
  3. WHERE (((OrderDetail.DeliveryMethod)=3))
  4. GROUP BY OrderDetail.OrderDate, OrderDetail.RouteNo, OrderDetail.CustomerNo
  5.  
I need to add 2 more items

"OrderDetail.Item and OrderDetail.Qty"

But I cannot have it as a part of an aggregation function.

Can anyone help me redesign this query to include these items.

I am really lousy at database so plz help me.
Sep 24 '07 #1
1 1202
Scott Price
1,384 Expert 1GB
Hi this is my query

Expand|Select|Wrap|Line Numbers
  1. SELECT OrderDetail.OrderDate, OrderDetail.RouteNo, OrderDetail.CustomerNo
  2. FROM OrderDetail
  3. WHERE (((OrderDetail.DeliveryMethod)=3))
  4. GROUP BY OrderDetail.OrderDate, OrderDetail.RouteNo, OrderDetail.CustomerNo
  5.  
I need to add 2 more items

"OrderDetail.Item and OrderDetail.Qty"

But I cannot have it as a part of an aggregation function.

Can anyone help me redesign this query to include these items.

I am really lousy at database so plz help me.
In order to group by you first need to select...

Try adding the two items first into your select statement, then later into the group by statement.

Regards,
Scott
Sep 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: G?nter Jantzen | last post by:
In the documentation http://www.python.org/dev/doc/devel/whatsnew/node7.html is written about itertools.groupby: """Like it SQL counterpart, groupby() is typically used with sorted input.""" ...
4
by: Bryan | last post by:
can some explain why in the 2nd example, m doesn't print the list which i had expected? >>> for k, g in groupby(): .... print k, list(g) .... 1 2 3
3
by: trebucket | last post by:
What am I doing wrong here? >>> import operator >>> import itertools >>> vals = .... (1, 16), (2, 17), (3, 18), (4, 19), (5, 20)] >>> for k, g in itertools.groupby(iter(vals),...
20
by: Frank Millman | last post by:
Hi all This is probably old hat to most of you, but for me it was a revelation, so I thought I would share it in case someone has a similar requirement. I had to convert an old program that...
1
by: Roman Bertle | last post by:
Hello, there is an example how to use groupby in the itertools documentation (http://docs.python.org/lib/itertools-example.html): # Show a dictionary sorted and grouped by value .... ...
13
by: 7stud | last post by:
Bejeezus. The description of groupby in the docs is a poster child for why the docs need user comments. Can someone explain to me in what sense the name 'uniquekeys' is used this example: ...
3
by: Steve Howell | last post by:
George Sakkis produced the following cookbook recipe, which addresses a common problem that comes up on this mailing list: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/521877 I...
10
by: 7stud | last post by:
I'm applying groupby() in a very simplistic way to split up some data, but when I timeit against another method, it takes twice as long. The following groupby() code groups the data between the...
3
by: Wiktor Zychla [C# MVP] | last post by:
could someone enlighten me on what would be the difference between GroupBy and ToLookup? I try hard but am not able to spot any difference between these two. the syntax and behavioral semantics...
1
by: jmarcrum | last post by:
Hey everyone, I have a question that's been troubling me for a bit. I work for Alabama Power. I have 1 table (tblOutages). Every morning I import a list of Power Outages for the state of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.