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:
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
-
From: Daevid Vincent [mailto:dae...@daevid.com]
Sent: Monday, October 24, 2011 1:46 PM
To: mysql@lists.mysql.com
Subject: Within-group aggregate query help please - customers and latest
subscription row
I know this is a common problem, and I've been struggling with it for a
full
day now but I
To: mysql@lists.mysql.com
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 for a single customer_id, so this is not
going
to scale).
Got
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 IN
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 to
26, 2006 7:15 AM
To: Robert DiFalco
Cc: mysql@lists.mysql.com
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 like this (untested):
INSERT
: Tuesday, September 26, 2006 7:15 AM
To: Robert DiFalco
Cc: mysql@lists.mysql.com
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 like
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
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
: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 (monthly_usage
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,
13 matches
Mail list logo