Hi all,
Could do with some help please.
I have a query that grabs details of items that have been ordered from
an ecommerce site. Order details are in "tracking" and ordered items in
"trackitem".
The query works fine and generates a row for each item, including bits
of info retrieved from
2011/10/24 16:31 -0700, Daevid Vincent
WHERE cs.customer_id = 7
GROUP BY customer_id
Well, the latter line is now redundant.
How will you make the '7' into a parameter?
--
MySQL General Mailing List
For list archives: http://l
October 24, 2011 4:06 PM
> To: [email protected]
> Subject: RE: Within-group aggregate query help please - customers and
latest
> subscription row
>
> A kind (and shy) soul replied to me off list and suggested this solution,
> however,
> this takes 28 seconds (that's f
-
> From: Daevid Vincent [mailto:[email protected]]
> Sent: Monday, October 24, 2011 1:46 PM
> To: [email protected]
> Subject: Within-group aggregate query help please - customers and latest
> subscription row
>
> I know this is a common problem, and I've been struggling
I know this is a common problem, and I've been struggling with it for a full
day now but I can't get it.
I also tried a few sites for examples:
http://www.artfulsoftware.com/infotree/queries.php#101
http://forums.devarticles.com/general-sql-development-47/select-max-datetime
-problem-10210.html
: Tuesday, September 26, 2006 7:15 AM
To: Robert DiFalco
Cc: [email protected]
Subject: Re: Updating two fields from an aggregate query
Robert, you might give "insert ... select ... on duplicate key update" a
try:
http://dev.mysql.com/doc/refman/5.0/en/insert-select.html
something
L PROTECTED]
Sent: Tuesday, September 26, 2006 7:15 AM
To: Robert DiFalco
Cc: [email protected]
Subject: Re: Updating two fields from an aggregate query
Robert, you might give "insert ... select ... on duplicate key update" a
try:
http://dev.mysql.com/doc/refman/5.0/en/insert-select.html
som
I have two tables that are related:
Parent
LONG id
LONG childCount
LONG maxChildAge
...
Child
LONG parentId
LONG age
...
There can be thousands of parents and millions of children, that is why
I have denormalized "childCount" and "maxChildAge". The values are too
expensive t
Robert, you might give "insert ... select ... on duplicate key update" a try:
http://dev.mysql.com/doc/refman/5.0/en/insert-select.html
something like this (untested):
INSERT INTO parent (id, maxChildAge, childCount)
SELECT parentid, MAX(age) as maxAge, COUNT(*) as ct
FROM child
WHERE parentid I
I have a query:
I am trying to get a percentage of the total for each city
SELECT userLog.city,userLog.region,
COUNT(*),
/*
Count(userLog.id) is always 1
was hoping to get the total row returned
*/
COUNT(*)/COUNT(userLog.id),
media.name,artist.name
FROM userLog,media,artist
WHERE userLog.medi
On Mon, Nov 12, 2001 at 11:14:21AM -0500, Johnson, Gregert wrote:
% SELECT SUM(d.AcctSessionTime) + IFNULL(m.Minutes, 0)
% FROM detail d LEFT OUTER JOIN monthly_usage m ON d.UserName = m.UserName
% WHERE d.UserName = 'foo';
%
% Or, to summarize for all users:
%
% SELECT d.UserName as user, SUM(d
Subject:Help with aggregate query
I'm logging RADIUS detail records to a MySQL database. Currently, I
crunch
the the detail table (containing individual records) once a month into
another table that contains aggregate usage
I'm logging RADIUS detail records to a MySQL database. Currently, I crunch
the the detail table (containing individual records) once a month into
another table that contains aggregate usage (monthly_usage).
CREATE TABLE monthly_usage (
UserName varchar(32) NOT NULL,
Realm varchar(64) NOT NULL
13 matches
Mail list logo