Dear all,
I stuck around one more simple problem today.
I have a table named *event_loc* having below data : ( It has many
columns but I show you main columns that I needed )
_*Tables Data :-*_
*source_idevent_text*
1233 meet
1233
You need to group by event_text, not obj_text:
select source_id ,event_text,count(*) from event_loc
group by source_id,event_text;
Date: Tue, 8 Feb 2011 16:31:39 +0530
From: adarsh.sha...@orkash.com
To: mysql@lists.mysql.com
Subject: Group By Problem
Dear all,
I stuck around one
hi all...
i have an issue with group by and ordering. apparently group by ignores
'order by id DESC'?!
an example is a table that has an id and a category fields. there are a
few categories under which records can be filed. so what i want is the
latest record from each category by doing
kalin mintchev wrote:
hi all...
i have an issue with group by and ordering. apparently group by ignores
'order by id DESC'?!
an example is a table that has an id and a category fields. there are a
few categories under which records can be filed. so what i want is the
latest record from each
Basically you can't do what you want either without temporary tables or
using a subselect. Subselects are only available in mysql 4.1+ (I think
- check the docs) so that may or may not be an option.
thanks... pardon my ignorance - how would i do that using subselects?
--
MySQL General
kalin mintchev wrote:
Basically you can't do what you want either without temporary tables or
using a subselect. Subselects are only available in mysql 4.1+ (I think
- check the docs) so that may or may not be an option.
thanks... pardon my ignorance - how would i do that using subselects?
but that will get you all records for that category not just the most
recently updated.
that's the main problem, isn't it?
what i'm looking for is the last record for EACH of the categories in the
table. i'm aware of the aformentioned options.
my problem with group by is that ignores
options.
my problem with group by is that ignores the DESC in order by. if i do:
select id from table group by category;
it does the same as if i do:
select id from table group by category order by id desc;
both queries return the FIRST found record for EACH category in ascending
order
Hello,
If got a simple sessions table basically holds a session id and datetime
field for last modification also a session type, so I can have several
records with the same session id, with different types and different
modification time. I want to get the latest modified record for any given
Try adding max(session_modified).
SELECT *,max(session_modified) AS LastMod FROM translines GROUP BY
session_id ORDER BY session_modified DESC
On Jun 29, 2005, at 8:00 AM, Lee Denny wrote:
Hello,
If got a simple sessions table basically holds a session id and
datetime
field for last
: Wednesday, June 29, 2005 8:00 AM
Subject: Simple GROUP / ORDER problem
Hello,
If got a simple sessions table basically holds a session id and datetime
field for last modification also a session type, so I can have several
records with the same session id, with different types and different
2 2005-06-28 20:38:18
Which is what I want, I'm sure this is a misunderstanding on my part,
but
does any one have any ideas?
All the best,
Lee
This is a very FAQ. It is the group-wise maximum problem and it is well
documented here:
http://dev.mysql.com/doc/mysql/en/example-maximum
Hi,
I've 2 tables of payments
1: payment emission (P: -- ID,ID_cli,tot)
2: part payments (A: -- ID,P_ID,val)
I'd like to retrieve all payment emissions, with all relative part
payments(with a left join), for all ID_cli
and I'd like to calculate the rest to pay...like tot-SUM(val).
but I
John:
A couple of suggestions. First, a better way to identify duplicate files
in to
use MD5 sum - MySQL can compute it with MD5(LOAD_FILE(fname)) if the file
is
residing on the server. It would be a good idea to store the md5 sum in
the table.
I think your problem can be solved with
CREATE
Hello,
do any body can help me, i have problem with mysql syntax may be.
Let's first explain. I have two servers that i store filename, size
... in records of video camera files.
I have one database with two tables:
Servers and Files;
Servers contain:
ServerID, ServerName, User, Password,
John:
A couple of suggestions. First, a better way to identify duplicate files in to
use MD5 sum - MySQL can compute it with MD5(LOAD_FILE(fname)) if the file is
residing on the server. It would be a good idea to store the md5 sum in the table.
I think your problem can be solved with
CREATE
Hi
I am using mysql 3.23 have a table 'scores' with following structure
compint(11)
scoreint(11)
I have total 1 lakh rows
consider following sample data
compscore
~
10.25
22.5
2.1.7
10.1
30.9
10.3
I
Say I have the following table (TBL):
KEY GRP VAL
1 A 2
2 A 3
3 A 1
4 B 2
5 B 1
6 B 3
select KEY, max(VAL) from TBL group by GRP gives:
KEY max(VAL)
1 3
4 3
the desired result though is:
KEY max(VAL)
2 3
6 3
any ideas on how to achieve this ?
* Lightware Software
Say I have the following table (TBL):
KEY GRP VAL
1 A 2
2 A 3
3 A 1
4 B 2
5 B 1
6 B 3
select KEY, max(VAL) from TBL group by GRP gives:
KEY max(VAL)
1 3
4 3
the desired result though is:
KEY max(VAL)
2 3
6 3
any
Hi,
I checked it with 3.23.54 on Windows
and got the same incorrect results.
Regards,
Dmitry
-Original Message-
From: Heikki Tuuri [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 12, 2002 11:30 PM
To: [EMAIL PROTECTED]
Subject: Re: Group by problem
Dmitry,
- Original
Dmitry,
- Original Message -
From: Dmitry Kosoy [EMAIL PROTECTED]
Newsgroups: mailing.database.mysql
Sent: Sunday, December 15, 2002 7:11 PM
Subject: RE: Group by problem
Hi,
I checked it with 3.23.54 on Windows
and got the same incorrect results.
...
The following sql operators
Hi,
The following sql operators caused to incorrect results:
CREATE TEMPORARY TABLE temp_list (
CurrID char(42) NOT NULL,
OriginalID char(42) NOT NULL ,
DocRevision int(16) unsigned NOT NULL
) TYPE=InnoDB;
insert into temp_list
select CurrID, OriginalID, max(DocRevision)
from
Dmitry,
- Original Message -
From: Dmitry Kosoy [EMAIL PROTECTED]
Newsgroups: mailing.database.mysql
Sent: Thursday, December 12, 2002 8:02 PM
Subject: Group by problem
Hi,
The following sql operators caused to incorrect results:
CREATE TEMPORARY TABLE temp_list (
CurrID char(42
try timestamp(14) instead.
[EMAIL PROTECTED] wrote:
Description:
Problem with timestamp(8) and GROUP BY
How-To-Repeat:
mysql CREATE TABLE test (
- id int auto_increment,
- dd timestamp(8),
- data int,
- PRIMARY KEY (id)
- );
Query OK, 0 rows affected (0.01 sec)
sitnikov,
Monday, May 27, 2002, 10:32:07 PM, you wrote:
s Description:
s Problem with timestamp(8) and GROUP BY
s How-To-Repeat:
mysql CREATE TABLE test (
s - id int auto_increment,
s - dd timestamp(8),
s - data int,
s - PRIMARY KEY (id)
s - );
s Query OK, 0 rows
On 27 May 2002, at 22:32, [EMAIL PROTECTED] wrote:
mysql SELECT dd,count(*) FROM test GROUP BY dd;
+--+--+
| dd | count(*) |
+--+--+
| 20020527 |1 |
| 20020527 |1 |
| 20020527 |1 |
| 20020527 |1 |
Description:
Problem with timestamp(8) and GROUP BY
How-To-Repeat:
mysql CREATE TABLE test (
- id int auto_increment,
- dd timestamp(8),
- data int,
- PRIMARY KEY (id)
- );
Query OK, 0 rows affected (0.01 sec)
mysql INSERT INTO test (data) VALUES(1),(2),(3),(4);
On Monday 07 May 2001 03:37, Andrew Leshkin wrote:
Hello,
I have the following perfomance problem with simple query on one of my
servers:
Here is my table ~6 records.
+-+-+--+-++-
---+
| Field | Type
Sir, look up Rand and ORDER BY in the documentation. I believe
there's an example of using Rand and ORDER BY to do this.
Bob Hall
Thanks for the answer. but actually I'm not saying that mysql is doing
wrong, I just want to know HOW can I group by codigo and then get 10 random
rows of the
Angel Behar wrote:
Hi !!!
I'm running 3.23.28-gamma under windows NT, but I have the following
problem.
I need to query some data and gruop by some field (codigo in this case) so I
run the following query :
SELECT codigo from ropa where cve_depto='3' AND cve_clase='06' AND activo =
Hi !!!
I'm running 3.23.28-gamma under windows NT, but I have the following
problem.
I need to query some data and gruop by some field (codigo in this case) so I
run the following query :
SELECT codigo from ropa where cve_depto='3' AND cve_clase='06' AND activo =
'A' AND p_credito 0 GROUP
31 matches
Mail list logo