On 2011-1-16 20:22, Jørn Dahl-Stamnes wrote:
Hello,
I got a table that store information about which photo-albums that a client is
viewing. I want to get the N last visited albums and use the query:
mysql> select album_id, updated_at, created_at from album_stats order by
updated_at desc limit
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
He meant the execution order, please use the agregation function as
suggested.
On 11-01-17 05:03, Jørn Dahl-Stamnes wrote:
> On Monday 17 January 2011 09:53, Steve Meyers wrote:
>> On 1/16/11 5:22 AM, Jørn Dahl-Stamnes wrote:
>>> mysql> select album_
On Monday 17 January 2011 09:53, Steve Meyers wrote:
> On 1/16/11 5:22 AM, Jørn Dahl-Stamnes wrote:
> > mysql> select album_id, updated_at, created_at from album_stats group by
> > album_id order by updated_at desc limit 8;
>
> I believe that your problem is that the group by happens before the
>
On 1/16/11 5:22 AM, Jørn Dahl-Stamnes wrote:
mysql> select album_id, updated_at, created_at from album_stats group by
album_id order by updated_at desc limit 8;
I believe that your problem is that the group by happens before the
order by. Since you're grouping, the updated_at column is not
Hello,
I think following query would help you
For Ascending
select cpid,sum(score),team from j group by cpid order by sum(score)
For Descending
select cpid,sum(score),team from j group by cpid order by sum(score) desc
Thanks!
2009/1/7 Phil
> A question on grouping I've never been able to sol
Phil
>is there any way to modify this query so that it would
>return the team having the most entries?
See "Within-group aggregates" at http://www.artfulsoftware.com/queries.php
PB
-
Phil wrote:
A question on grouping I've never been able to solve...
create table j (proj char(3), id int
select * from t where emailaddress in
(select emailaddress from t group by emailaddress having count(*) > 1)
order by emailaddress;
Thanks,
Michael
-Original Message-
From: [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Wed, 30 Aug 2006 5:17 PM
Subject: Group By question
I have a tab
006 3:02 AM
Subject: Re: Group By question
Chris,
>I would like to query all rows that have more
>than one person with the same email address.
select id,count(emailaddr) as howmany
from tbl t1 join tbl t2 using(emailaddr)
group by id
having howmany>1;
PB
Chris,
>I would like to query all rows that have more
>than one person with the same email address.
select id,count(emailaddr) as howmany
from tbl t1 join tbl t2 using(emailaddr)
group by id
having howmany>1;
PB
-
Chris W wrote:
I have a
table of people with one of the fields being
Perfect! Thank you.
> -Original Message-
> From: Harald Fuchs [mailto:[EMAIL PROTECTED]
> Subject: Re: Group By Question
> SELECT category_fk,
>sum(case status when 1 then 1 else 0 end) AS 'status=1',
>sum(case status when 2 then 1 else 0 end)
In article <[EMAIL PROTECTED]>,
"Fan, Wellington" <[EMAIL PROTECTED]> writes:
> Hello Listfolk,
> I have a table with a 'category_fk' column and a 'status' column. 'Status'
> has but a tiny handful of known values, kinda like an enum.
> I'd like to form a query that would give me results like:
* Bengt Lindholm
> I have a table where I need to group the content on a timestamp. Any
> record that is less than say 5 minutes from any other record needs to
> be grouped with that other record.
>
> ID timestamp
> 1 2004-02-02 12:00:00
> 2 2004-02-02 12:00:05
> 3 2004-02-02 12:05:20
Bengt Lindholm wrote:
In your example they would all be in the same group. You could say the
group delimiter is any gap between records that is 5 minutes or more. So
records would be in the same group even if the total timespan for the
group is more than 5 minutes, but all gaps between individua
On 2004-02-10, at 16.21, Brian Power wrote:
I'm not sure if it is possible to do with a group by
Say you had
1 2004-02-02 12:00:00
2 2004-02-02 12:00:05
3 2004-02-02 12:00:09
4 2004-02-02 12:00:12
this would require 1,2 and 3 in one group and
2,3,4 in another. My understanding is that you
I'm not sure if it is possible to do with a group by
Say you had
1 2004-02-02 12:00:00
2 2004-02-02 12:00:05
3 2004-02-02 12:00:09
4 2004-02-02 12:00:12
this would require 1,2 and 3 in one group and
2,3,4 in another. My understanding is that you cant have the same rec in two
groups
I thi
Sir, try
SELECT g1.name, g1.score, g1.id
FROM grades g1, grades g2
WHERE g1.name = g2.name
GROUP BY g1.name, g1.score
HAVING Max(g1.score) = Max(g2.score);
Bob Hall
>Q: I have the following table "grades".
>
>++++
>| name | score |id |
>+
16 matches
Mail list logo