ON t.ClientID=c.ID
LEFT JOIN tocname tc ON t.TOC=tc.toc
LEFT JOIN network n ON t.NetworkID=n.ID
WHERE t.toc=1
AND SUBSTRING(t.Day,1,7) = '2013-08'
AND SUBSTRING(t.Day,1,7) = '2013-11')
GROUP BY t.AccountID,
t.ClientID,
t.Service,
t.NetworkID
a shorter but equivalent query, you have:
(SELECT t.id, t.name, SUM(val) FROM t1 t)
UNION
(SELECT t.id, t.name, SUM(val) FROM t2 t)
GROUP BY t.id, t.name;
That does not work in 5.0 either (at least in 5.0.96):
ERROR 1064 (42000): You have an error in your SQL syntax; check
- Original Message -
From: Machiel Richards machiel.richa...@gmail.com
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'GROUP BY t.AccountID,
I suspect your query has never
): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'GROUP BY t.AccountID,
I suspect your query has never been doing what you think at all, and you need to
select [fields] from (
select fields1 blahblah
) FROM t1 t)
UNION
(SELECT t.id, t.name, SUM(val) FROM t2 t)
GROUP BY t.id, t.name;
That does not work in 5.0 either (at least in 5.0.96):
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax
On Wed, Sep 19, 2012 at 6:56 PM, Rick James rja...@yahoo-inc.com wrote:
my counts are 3 times too much.
Without studying the code, I would guess that there is a JOIN between he data
that needs COUNTing and the GROUP BY for the COUNT. That is, it collects
more 'joined' rows before counting
2012/09/18 06:53 -0400, Larry Martell
This works fine. But now I need to get a certain column
(image_measurer_id) with each row returned that corresponds to the row
from the group that has bottom = Min(bottom), bottom = Max(bottom),
bottom closest to Avg(bottom), and bottom from the row where
:00' AND '2010-03-04
23:59:59'
AND data_target.id = data_cst.target_name_id
GROUP BY rollup.Target, rollup.EP
ORDER BY ABS(data_cst.bottom - rollup.`Avg Bottom`)
LIMIT 1 -- --
rollup is the name of the temp table that I was testing with. It
contains
On Wed, Sep 19, 2012 at 12:04 AM, h...@tbbs.net wrote:
2012/09/18 06:53 -0400, Larry Martell
This works fine. But now I need to get a certain column
(image_measurer_id) with each row returned that corresponds to the row
from the group that has bottom = Min(bottom), bottom = Max(bottom
On Wed, Sep 19, 2012 at 12:04 AM, h...@tbbs.net wrote:
2012/09/18 06:53 -0400, Larry Martell
This works fine. But now I need to get a certain column
(image_measurer_id) with each row returned that corresponds to the row
from the group that has bottom = Min(bottom), bottom = Max(bottom
to the row
from the group that has bottom = Min(bottom), bottom = Max(bottom),
bottom closest to Avg(bottom), and bottom from the row where date_time
= Max(date_time).
There is a standard and ugly way of getting such a thing, but it entails
repeating the table reference (supposing you want any
OK, I think I have this working. The last join was this:
JOIN (select id, target_name_id, ep,date_time from data_cst WHERE
target_name_id IN (775, 776, 777, 778, 779, 780, 45, 44, 116, 117,
118, 119, 120, 121) AND data_cst.date_time BETWEEN '2010-03-04
00:00:00' AND '2010-03-04 23:59:59' GROUP
)
AND data_cst.date_time BETWEEN '2010-03-04 00:00:00' AND
'2010-03-04 23:59:59'
GROUP BY target_name_id, ep, wafer_id
HAVING count(*) 999) q1
JOIN (SELECT data_cstimage.name as minImage,
data_cst.bottom
my counts are 3 times too much.
Without studying the code, I would guess that there is a JOIN between he data
that needs COUNTing and the GROUP BY for the COUNT. That is, it collects more
'joined' rows before counting. Fixing it will probably make the query even
messier.
-Original
2012/09/19 14:36 -0400, Larry Martell
MIN(ABS(Avg(bottom) - bottom))
Is not valid. It gives:
ERROR (HY000): Invalid use of group function
Yes, I had my doubts of that, for all that I suggested it.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
,
MAX(bottom) - MIN(bottom) as Ranges
FROM data_cst
WHERE target_name_id IN (775, 776, 777, 778, 779, 780, 45, 44,
116, 117, 118, 119, 120, 121)
AND data_cst.date_time BETWEEN '2010-03-04 00:00:00' AND
'2010-03-04 23:59:59'
GROUP BY target_name_id, ep, wafer_id
:00:00' AND
'2010-03-04 23:59:59'
GROUP BY target_name_id, ep, wafer_id
HAVING count(*) 999) q1,
data_target
WHERE data_target.id = target_name_id
GROUP BY q1.target_name_id, q1.ep;
This works fine. But now I need to get a certain column
(image_measurer_id) with each row
IN (775, 776, 777, 778, 779, 780, 45, 44,
116, 117, 118, 119, 120, 121)
AND data_cst.date_time BETWEEN '2010-03-04 00:00:00' AND
'2010-03-04 23:59:59'
GROUP BY target_name_id, ep, wafer_id
HAVING count(*) 999) q1,
data_target
WHERE data_target.id = target_name_id
: Re: getting certain rows from a group by
On Tue, Sep 18, 2012 at 7:52 AM, Peter Brawley
peter.braw...@earthlink.net wrote:
On 2012-09-18 5:53 AM, Larry Martell wrote:
I have this query:
SELECT data_target.name as Target,
q1.ep as EP,
COUNT(*) as Wafers
(bottom) - MIN(bottom) as Ranges
FROM data_cst
WHERE target_name_id IN (775, 776, 777, 778, 779, 780, 45, 44,
116, 117, 118, 119, 120, 121)
AND data_cst.date_time BETWEEN '2010-03-04 00:00:00' AND
'2010-03-04 23:59:59'
GROUP BY target_name_id, ep, wafer_id
(bottom), ... )
JOIN data_cst mn ON bottom = @min
JOIN data_cst mx ON bottom = @max
Can you elaborate on this? I don't see how this will give me what I
need. I'm not looking for the min or max bottom - I already have that
- I'm looking for the row from each group that has the min and max
: If two rows have bottom = @min, it returns both.
-Original Message-
From: Larry Martell [mailto:larry.mart...@gmail.com]
Sent: Tuesday, September 18, 2012 12:54 PM
To: Rick James
Cc: peter.braw...@earthlink.net; mysql@lists.mysql.com
Subject: Re: getting certain rows from a group
= rollup.EP
AND data_cst.date_time BETWEEN '2010-03-04 00:00:00' AND '2010-03-04 23:59:59'
AND data_target.id = data_cst.target_name_id
GROUP BY rollup.Target, rollup.EP
ORDER BY ABS(data_cst.bottom - rollup.`Avg Bottom`);
Any way to work that into another join?
Thanks!
-Original Message
= data_cst.target_name_id
GROUP BY rollup.Target, rollup.EP
ORDER BY ABS(data_cst.bottom - rollup.`Avg Bottom`)
LIMIT 1 -- --
-Original Message-
From: Larry Martell [mailto:larry.mart...@gmail.com]
Sent: Tuesday, September 18, 2012 2:57 PM
To: Rick James
Cc: peter.braw
In the last episode (Mar 27), Paul Halliday said:
Say I have:
SELECT COUNT(name), name, COUNT(DISTINCT(status)) FROM table GROUP BY name
and it returns:
20 paul 5
19 john 2
75 mark 3
is there a way to return what comprises DISTINCT(status) as part of the
result?
so:
20 paul
On Tue, Mar 27, 2012 at 3:43 PM, Dan Nelson dnel...@allantgroup.com wrote:
In the last episode (Mar 27), Paul Halliday said:
Say I have:
SELECT COUNT(name), name, COUNT(DISTINCT(status)) FROM table GROUP BY name
and it returns:
20 paul 5
19 john 2
75 mark 3
is there a way to return
I'm not sure your method isn't working, but try changing changing the to
date part to '2012-02-08' and see what you get.
HTH,
Arthur
Thanks, it seems to be working now. I just discovered WITH ROLLUP. It made me
very
happy on this project...
On 2/8/12 2:54 AM, Arthur Fuller wrote:
I'm not sure your method isn't working, but try changing changing the to date part to
'2012-02-08' and see what you get.
HTH,
Arthur
--
I am having a problem with select results that I don't understand. It seems to
be tied up with a GROUP BY statement. Forgive the complexity of the SQL, I
inherited some problematic data structuring.
If I use this statement:
SELECT lu_rcode_bucket.bucket AS 'BUCKET',
CP_PKG.value
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://lists.mysql.com
7 2005-08-04
1035167192 billme 7 2004-02-08
SELECT MAX(`date`) FROM `customers_subscriptions` WHERE customer_id = 7
GROUP BY customer_id;
gives me 2005-08-04 obviously, but as you all know, mySQL completely takes a
crap on your face when you try what would seem
FROM
customers_subscriptions AS cs
GROUP BY customer_id) AS `x`
ON s.customer_id = x.customer_id
AND s.date = x.LastDate
WHERE c.customer_id = 7;
There are 781,270 customers (nearly 1 million) and 1,018,092
customers_subscriptions AS cs
WHERE cs.customer_id = 7
GROUP BY customer_id
) AS `x`
ON s.customer_id = x.customer_id
AND s.date = x.LastDate
WHERE c.customer_id = 7;
To get ALL customers and their last
I am trying to optimize a query that uses a group by on a varchar(255)
column. The column has a large enough cardinality that a 10 character
partial index uniquely covers over 99% of all values. I was hoping
that this partial index would be able to help with the group by
(though obviously
Aveek, Simcha, Johan,
Thanks for explaining the situation. I knew there were some reserved
words, but I hadn't realized there were so many.
Anyway, now that I know I can protect my column names with backticks,
I'm good to go.
--
Dave M G
--
MySQL General Mailing List
For list archives:
MySQL users,
Simple question:
In one table in my database, the column was named group.
I kept getting failed query errors until I renamed the column.
I've never before encountered a situation where MySQL mistook a column
name for part of the query syntax.
Should I never use the word group
question:
In one table in my database, the column was named group.
I kept getting failed query errors until I renamed the column.
I've never before encountered a situation where MySQL mistook a column
name for part of the query syntax.
Should I never use the word group for column names
, the column was named group.
I kept getting failed query errors until I renamed the column.
I've never before encountered a situation where MySQL mistook a column
name for part of the query syntax.
Should I never use the word group for column names? Seems a little
silly. Is there a way to protect
backticks, not quotes.
`group`, not 'group'.
--
Simcha Younger sim...@syounger.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
On Thu, Feb 24, 2011 at 12:06 PM, Dave M G d...@articlass.org wrote:
Should I never use the word group for column names? Seems a little
silly. Is there a way to protect column names to that there is no
confusion?
As several people already pointed out, simply use backticks. Simple quotes
have
:
Should I never use the word group for column names? Seems a little
silly. Is there a way to protect column names to that there is no
confusion?
As several people already pointed out, simply use backticks. Simple quotes
have started to work in more and more places in newer versions of MySQL
a great idea. I am going to change my table
names to Table, Group, Having, Select, Into, Order By,
Update, Delete etc. just to confuse hackers so they won't be able to
launch a sql injection attack against my website. The naming convention
will drive them crazy.
Mike
(Just kidding)
On Feb 24
) in the query. For more
details refer to
http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html
Thanks
Aveek
Hmmm. Everyone has given me a great idea. I am going to change my table
names to Table, Group, Having, Select, Into, Order By,
Update, Delete etc. just to confuse hackers so
3
performs 1
13456 Minister 1
I tried the below query :
*select source_id ,event_text,count(*) from event_loc group by
source_id,obj_text ;*
But displays only unique record_id rows but I want
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
:18:58 | 2011-01-16 11:13:04 |
+--+-+-+
8 rows in set (0.09 sec)
The problem is that album_id 81 is occuring two times in the list. So I
thought I should add a group by in the query:
mysql select album_id, updated_at, created_at from album_stats
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
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
order
, 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
deterministic. If there are multiple rows per album_id, any one of
those
|
+--+-+-+
8 rows in set (0.09 sec)
The problem is that album_id 81 is occuring two times in the list. So I
thought I should add a group by in the query:
mysql select album_id, updated_at, created_at from album_stats group by
album_id order by updated_at desc limit
Hi Johan,
On Sun, Dec 19, 2010 at 7:11 PM, Johan De Meersman vegiv...@tuxera.bewrote:
You can't query the index directly, but if you select only fields that are
in the index, no table lookups will be performed - this is called a covering
index.
Great.. Thanks for the confirmation.
Regards,
On Sun, Dec 19, 2010 at 3:19 AM, Feris Thia
milis.datab...@phi-integration.com wrote:
Hi Everyone,
Is there a way to query values stored in our index instead of using group
by selection which will produce same results ?
You can't query the index directly, but if you select only fields
Hi Everyone,
Is there a way to query values stored in our index instead of using group
by selection which will produce same results ?
Please advice..
Regards,
Feris
I have tables:
CREATE TABLE `tblNames` (
` IdName` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(60) DEFAULT NULL,
PRIMARY KEY (`IdName`),
) ENGINE=MyISAM
CREATE TABLE `tblStatusy` (
`IdStatus` int(11) NOT NULL AUTO_INCREMENT,
`IdName` int(11) DEFAULT NULL,
`Status`
Hi all,
Aveeks solution should work if you have at least one call for each intervall.
It's the classical GROUP BY solution that only works on the available dataset.
Although it should work pretty well in the cited scenario, you will miss
intervals (from a all intervals report point of view
(step.n - 5) and calls.queue_seconds
= step.n
group by n;
+---+---+
| calls | queue_seconds |
+---+---+
| 250 | 0 |
| 168 | 5 |
| 268 | 10 |
| 0 | 15 |
+---+---+
4 rows in set (0.00 sec)
-Travis
no matching rows.
sum(calls) from calls group by 5 * floor(seconds/5)
sum(calls) from calls group by 5 * floor(5/5)
sum(calls) from class group by 5 * 1
sum(calls) from class group by 5
is correct
2nd(seconds/5) interval example
10/5=2
floor(10/5)=2
supplied value would truncate and give you the int
no matching rows.
sum(calls) from calls group by 5 * floor(seconds/5)
sum(calls) from calls group by 5 * floor(5/5)
sum(calls) from class group by 5 * 1
sum(calls) from class group by 5
is correct
2nd(seconds/5) interval example
10/5=2
floor(10/5)=2
supplied value would truncate and give you the int
Hi Aveek,
I think Ghulam just want to count calls for each intervals
so the query should looks like this:
select count(*) as total_calls, queue_seconds
from calls group by queue_seconds order by total_calls;
- Original Message -
From: Aveek Misra ave...@yahoo-inc.com
To: Ghulam Mustafa
in
-- returns all geneNames (symbols) with one unique combination of chrom and
strand
(select geneName from
-- returns all unique combinations of symbol, chrom, and strand
(select distinct geneName, chrom, strand
from refFlat) sub1
group by geneName
having count(*) = 1)
group by refSeq
having
symbols but different
chrom and strand). Could anybody show me how to do it?
select geneName as symbol, name as refSeq, chrom, strand, txStart from
refFlat group by refSeq having count(*)=1;
I think that something like
SELECT name FROM (SELECT name, type_id FROM (SELECT * FROM foods));
works
Hi everyone,
i have two columns (seconds, number of calls), i need to produce a
report which will show total number of calls in intervals (let'say 10
seconds interval), i know i can do this programmability in my script but
i was wondering if it's possible to accomplish this behavior within
mysql.
try this ...
select 5 * floor(seconds/5) as start, 5 * floor(seconds/5) + 5 as end,
sum(calls) from calls group by 5 * floor(seconds/5);
This should give you an output of the type
+---+--++
| start | end | sum(calls) |
+---+--++
| 0 |5
products a join vendors b on a.vendor_id = b.vendor_id group by a.type,
a.vendor_id, b.vendor_name all rows are returned because the
type/vendor_id/vendor_name are unique amongst each row. If you remove the
vendor_id and vendor_name from the group by, you get a single row with the
lowest cost
Scott,
I would like to obtain the least cost of each product type and its
associated vendor.
See Within-group aggregates at
http://www.artfulsoftware.com/infotree/queries.php.
PB
-
On 7/14/2010 9:25 AM, Scott Mullen wrote:
I'm having trouble formulating a query to gather
in the result set here.)
Try this:
select name, product_type, min(cost) from vendors join products on
vendors.id = products.vendor_id group by product_type;
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql
Date: Wed, 14 Jul 2010 10:25:22 -0400
Subject: Select w/ group by question
From: smulle...@gmail.com
To: mysql@lists.mysql.com
I'm having trouble formulating a query to gather the following data. I can
do this via a script, but now it is more or less just bothering me
( MIN( CONCAT( LPAD(price,6,0),supplier) ), 7) AS MinSupplier,
LEFT( MIN( CONCAT( LPAD(price,6,0),supplier) ), 6)+0 AS MinPrice,
SUBSTR( MAX( CONCAT( LPAD(price,6,0),supplier) ), 7) AS MaxSupplier,
LEFT( MAX( CONCAT( LPAD(price,6,0),supplier) ), 6)+0 AS MaxPrice
FROM products
GROUP
) NOT NULL,
`weight` int(10) NOT NULL,
PRIMARY KEY (`tableid1`,`tupleid1`,`tableid2`,`tupleid2`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
and I'm running this query (note the 'group by'):
insert into graph (node1, node2, tableid1, tupleid1, tableid2,
tupleid2, weight)
select 0, 0
`,`tupleid1`,`tableid2`,`tupleid2`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
and I'm running this query (note the 'group by'):
insert into graph (node1, node2, tableid1, tupleid1, tableid2,
tupleid2, weight)
select 0, 0, a.tableid, a.tupleid, b.tableid, b.tupleid, count(*)
from
i have a question, i'm searching for a while and do not find some reference
how to do that.
a simple query return this:
dato1 dato2 dato3 estado1 fecha1
dato1 dato2 dato3 estado2 fecha2
dato1 dato2 dato3 estado3 fecha3
dato4 dato5 dato6 estado1 fecha4
dato4 dato5 dato6 estado2 fecha5
dato4 dato5
fecha1,fecha2,fecha3, which you can then split in your application code.
Make sure you don't include your the estado or fecha columns in the
GROUP BY clause (in your case you would want to group by the first three
columns only).
http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html
I've written a helpdesk ticket problem and am working on the statistics
module. I'm having problems with group by. For instance, I want to get
the count of the number of different problem types, by how many were
solved by each person. This is my statement:
mysql select distinct accepted_by
try this:
select accepted_by, problem_type, count(*) from form
where problem_type is not NULL
AND problem_type != 'Test'
AND accepted_by is not null
group by accepted_by, problem_type
On Wed, Oct 28, 2009 at 12:05 PM, Adam Williams
awill...@mdah.state.ms.us wrote:
I've written a helpdesk
works perfectly, i didn't know you could use multiple columns in the
group by. thanks a bunch!
Michael Dykman wrote:
try this:
select accepted_by, problem_type, count(*) from form
where problem_type is not NULL
AND problem_type != 'Test'
AND accepted_by is not null
group by accepted_by
) AS thecount,
COUNT( * ) / ( SELECT COUNT( * ) FROM agents ) AS percentage
FROM agents
GROUP BY user_agent_parsed
ORDER BY thecount DESC LIMIT 50;
Second issue, once a day I need to archive the result of the above.
Any suggestions on how to best to do that? I can schedule with cron
the newest note (if any) for each
customer.
If all I want is the date, then I can do
SELECT Cust.CustID, MAX(Notes.NoteTime) FROM Cust LEFT JOIN Notes ON
Cust.CustID = Notes.Cust_ID GROUP BY Cust.CustID;
That will work just fine, but now I also want the NoteText associated with the
newest
Jerry,
I want to find the newest note (if any) for each customer.
See Within-group aggregates at
http://www.artfulsoftware.com/infotree/queries.php
http://www.artfulsoftware.com/queries.php
PB
-
Jerry Schwartz wrote:
It must be too late in the week...
Suppose table Cust has
Commonly refered to as a groupwise max
http://dev.mysql.com/doc/refman/5.0/en/example-maximum-column-group-row.html
http://jan.kneschke.de/projects/mysql/groupwise-max/
Regards,
Gavin Towey
-Original Message-
From: Jerry Schwartz [mailto:jschwa...@the-infoshop.com]
Sent: Friday
15059,115146,115244,115541,115689,116305,116405,116762,117148,117296,117389,117504,117779,117945,118285,118447,118571,118752)
GROUP BY cache_property_str.name
ORDER BY NULL
LIMIT 10
9,105909,106173,106311,106459,107118,107320,107662,107970,108155,108379,108418,108618,108779,108960,109506,109691,110067,110469,110698,110806,111201,111286,111641,112174,112375,112568,112656,113094,113248,113344,113449,113561,113909,114170,114322,114432,115059,115146,115244,115541,115689,116305,116405,116762,117148,117296,117389,117504,117779,117945,118285,118447,118571,118752)
GROUP
Peter,
I am fairly certain, it's not slow because of the event_id look up but
because of the GROUP BY
Suhail
On Sun, Aug 16, 2009 at 2:56 PM, Peter Brawley
peter.braw...@earthlink.netwrote:
Suhail,
Having problems with this query, any ideas on how to optimize this further?
Did you try
|
+---+---+-+
which not groups correctly. Seems it's a hard query.
- Original Message -
From: Darryle Steplight dstepli...@gmail.com
To: Elim PDT e...@pdtnetworks.net
Cc: mysql@lists.mysql.com
Sent: Wednesday, July 15, 2009 11:50 PM
Subject: Re: Hard? query to with group order by group
| NULL |
| 4 | John | 3 |
| 5 | Jane | 3 |
+---+---+-+
Record with null head_id means
the member is a group head.
Record with head_id k are in the
group with head whoes id equals k.
I like to fetch the rows in the following ordaer
|
+---+---+-+
Record with null head_id means
the member is a group head.
Record with head_id k are in the
group with head whoes id equals k.
I like to fetch the rows in the following ordaer
| 3 | David | NULL |
| 4 | John | 3 |
| 5 | Jane | 3 |
| 1 | Elim | NULL |
| 2 | Ann | 1
I am hoping I can get some help with a query I am trying to construct:
I want to group by a 'contract' column and get the sum of the 'amlp' column
values associated with each contract. I can do a select and group by on
contract
select contract from maintenance group by contract;
and I will get
select contract , sum(amlp)
from maintenance
group by contract;
On Mon, Jul 20, 2009 at 6:50 PM, Hagen finha...@comcast.net wrote:
I am hoping I can get some help with a query I am trying to construct:
I want to group by a 'contract' column and get the sum of the 'amlp' column
values
Thanks! That did the trick.
-Original Message-
From: Olexandr Melnyk [mailto:omel...@gmail.com]
Sent: Monday, July 20, 2009 10:02 AM
To: mysql@lists.mysql.com
Subject: Re: Group by column and Sum another
select contract , sum(amlp)
from maintenance
group by contract;
On Mon, Jul 20
My table group_member looks like this:
+---+---+-+
| member_id | name | head_id |
+---+---+-+
| 1 | Elim |NULL |
| 2 | Ann | 1 |
| 3 | David |NULL |
| 4 | John | 3 |
| 5 | Jane | 3 |
I see such nice formated text output serving to illustrate people's
tables and I think it must be due to some code which is spitting
that out, rather than people typing so painstakingly. What is that
function/MySQL/code?
It's the default output format of the mysql command line client,
On 16 Jul 2009, at 15:02, Govinda wrote:
I see such nice formated text output serving to illustrate people's
tables and I think it must be due to some code which is spitting
that out, rather than people typing so painstakingly. What is that
function/MySQL/code?
It's the default output
On 16 Jul 2009, at 15:26, Govinda wrote:
Meaning that on a shared hosting situation, without ssh, then I
cannot do that, right?
Not necessarily - you can run the client locally and connect to the
remote DB. It depends if your host allows remote access to mysql (they
might do on
|
+---+---+-+
Record with null head_id means
the member is a group head.
Record with head_id k are in the
group with head whoes id equals k.
I like to fetch the rows in the following ordaer
| 3 | David |NULL |
| 4 | John | 3 |
| 5 | Jane
Hi Elim,
I didn't test it out but it sounds like you want to do this
SELECT * FROM group_members GROUP BY head_id, member_id ORDER BY name
ASC .
On Thu, Jul 16, 2009 at 1:20 AM, Elim PDTe...@pdtnetworks.net wrote:
My table group_member looks like
Hi,
I am using a technique described here at:
http://forums.mysql.com/read.php?20,227102,227102#msg-227102
To make results Random before applying the GROUP BY method.
The query to my table structure is this:
SELECT r.physicians_id,
(SELECT r1.id FROM physicians_images r1 WHERE
(r.physicians_id
to do the query, and added a group by CollegeID' with no luck..
so how can i combine the two rows to get a single row??
thanks
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Try with GROUP_CONCAT(ScriptName)
http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat
2009/6/12 bruce bedoug...@earthlink.net
Hi...
I have the following...
mysql INSERT INTO ParseScriptTBL VALUES
- ('auburnCourse.py',40,1,1),
- ('auburnFaculty.py
hi martin...
thanks for the reply.. but that still generates two separate rows as well...
-Original Message-
From: Martin Gainty [mailto:mgai...@hotmail.com]
Sent: Friday, June 12, 2009 12:04 PM
To: bruce Douglas
Subject: RE: a possible group issue???
mysql select * from
Can someone point a link, or show an example.
basically, i have something like
select week(mydate), count(mystuff) from table group by week(mydate);
however, I need week to start on Wed 9am and end next Wed.
What's the easiest way to accomplish that?
thanks,
andrey
--
MySQL General Mailing
) DT2 FROM (SELECT
DATE_ADD(DATE(DATE_ADD(NOW(),INTERVAL (DOW-DAYOFWEEK(NOW())) DAY)),INTERVAL HR
HOUR) DT FROM (SELECT 4 DOW, 9 HR) AA) AAA) B
Where A.mydate = B. DT1_9AM
And A.mydate B. DT2_9AM
group by week(A.mydate);
Give it a Try !!!
Rolando A. Edwards
MySQL DBA (CMDBA)
155 Avenue
1 - 100 of 1052 matches
Mail list logo