d aggregating, adding data.
> I think developers took care of uniqueness of the rows, and constructed it
> in conformity with good design practices.
>
> What I'm only guessing is when I lock, dump and remove then insert,
> aggregate could there be problems with keys? And no data l
Totally with you, I had to get up and wash my hands after writing such
filth =)
On Mon, Feb 29, 2016 at 12:14 PM, Gary Smith wrote:
> On 29/02/2016 16:32, Steven Siebert wrote:
>
>>
>> At risk of giving you too much rope to hang yourself: if you use
>> mysqldump to dump the database, if you use
On 29/02/2016 16:32, Steven Siebert wrote:
At risk of giving you too much rope to hang yourself: if you use
mysqldump to dump the database, if you use the --replace flag you'll
convert all INSERT statements to REPLACE, which when you merge will
update or insert the record, effectively "mergin
regating,
adding data.
I think developers took care of uniqueness of the rows, and
constructed it in conformity with good design practices.
What I'm only guessing is when I lock, dump and remove then
insert, aggregate could there be problems with keys? And no
data loss during dump+remo
gic word
>> you're after?
>>
>> I realize this all might look rather like a bird fiddling with a worm
> instead of lion going for quick kill. I replicate wherever I need and can,
> here a have very little control over one end.
> On that end with little control there
- Original Message -
> From: "lejeczek"
> Subject: Re: dump, drop database then merge/aggregate
>
> today both databases are mirrored/identical
> tonight awkward end will dump then remove all the data, then
> collect some and again, dump then remove
> and
d.
On that end with little control there is one simple
database, which data I'll need to be removed on regular
basis, before removing I'll be dumping and I need to use
those dumps to add, merge, aggregate data to a database on
the other end, like:
today both databases are mirrored/
On 29/02/2016 15:30, lejeczek wrote:
On 28/02/16 20:50, lejeczek wrote:
fellow users, hopefully you experts too, could help...
...me to understand how, and what should be the best practice to dump
database, then drop it and merge the dumps..
What I'd like to do is something probably many have
On 28/02/16 20:50, lejeczek wrote:
fellow users, hopefully you experts too, could help...
...me to understand how, and what should be the best
practice to dump database, then drop it and merge the dumps..
What I'd like to do is something probably many have done
and I wonder how it's done best.
fellow users, hopefully you experts too, could help...
...me to understand how, and what should be the best
practice to dump database, then drop it and merge the dumps..
What I'd like to do is something probably many have done and
I wonder how it's done best.
A box will be dumping a database (m
On 2015/05/07 19:42, Paul Halliday wrote:
Should have showed the whole thing. Take a look here (click image to see
full output):
http://www.pintumbler.org/tmp
I don't see why this worries you. Joining often increases variation.
Indeed, if in some case an inner join never did, maybe the joined
many group_concats against the same table with varying
>> results and they don't affect COUNT() but once I do that JOIN things start
>> to fall apart.
>>
>> What is happening behind the scenes?
>>
>> Thanks!
>>
>> Here's a simple test. Chang
First, have you tried GROUP_CONCAT(DISTINCT types) ?
Second I see my counts rise just as my group_concat() terms when I do
something similar to what you're talking about. Also, here:
val c_types d_types
3t9,t9,t9 a2,a3,a9
Your column headers don't seem to match your query.
COUNT() but once I do that JOIN things start
to fall apart.
What is happening behind the scenes?
Thanks!
Here's a simple test. Change the query to no longer have the aggregate
functions, then start counting rows by hand.
SELECT
val AS n
, types AS c_types
, two.types AS d_types
FROM
Fighting a bit with this one...
If I do something like (pseudo):
SELECT count(val) AS n, GROUP_CONCAT(types) AS c_types FROM tbl1
returns something like:
n c_types
1 t9
when I add a left join though:
SELECT count(val) AS n, GROUP_CONCAT(types) AS c_types,
GROUP_CONCAT(two.types) AS d_types
2012/09/04 11:43 -0700, Rick James
int(1) does not mean what you think. Probably you want TINYINT UNSIGNED.
Yeap, a real misfeature of MySQL. It is also one of the ways wherin MySQL puts
in C and takes PL1 away.
--
MySQL General Mailing List
For list archives: http://lists.m
2012/09/04 11:43 -0700, Rick James
You have DATETIME and TIMESTAMP. Keep in mind that TIMEZONE is timezone-aware;
DATETIME is not.
TIMEZONE is typo for TIMESTAMP?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.m
re we try to discuss your Aggregate question.
> -Original Message-
> From: Ron Piggott [mailto:ron.pigg...@actsministries.org]
> Sent: Friday, August 31, 2012 3:22 AM
> To: mysql@lists.mysql.com
> Subject: Aggregate
>
>
> I am unsure of which Aggregate f
I am unsure of which Aggregate function to use with the query (below) Right now
thread_date_reference and last_post_membership_reference produce NULL results.
I expect the NULL result is because of the LEFT OUTER JOIN and there being no
matching JOIN in the table articles_discussion , as well
info retrieved from other tables.
So the next thing I need to do is aggregate rows that are for the same
item, at the same price. I've looked at GROUP BY but can't figure out
how to get it to group rows with same product name and price, and
generate a column with the total of th
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: 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 f
-
> 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
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
Why? Because it's Friday and I'm feeling silly :)
mysql> SELECT * FROM sales;
+--+---++
| company | state | sales |
+--+---++
| ABC | AZ| 140.01 |
| XYZ | AZ| 17.76 |
| ABC | NY| 123.45 |
| XYZ
10) 285-7200 [EMAIL PROTECTED]
-Original Message-
From: Ian Simpson [mailto:[EMAIL PROTECTED]
Sent: Friday, July 25, 2008 11:15 AM
To: David Ruggles
Cc: 'mysql'
Subject: RE: How do I (can I) use aggregate functions inside a select
Hi David,
Try
Select company, state, sales, sum(s
>-Original Message-
>From: David Ruggles [mailto:[EMAIL PROTECTED]
>Sent: Friday, July 25, 2008 10:53 AM
>To: 'mysql'
>Subject: RE: How do I (can I) use aggregate functions inside a select
>
>I get:
>Error Code : 1140
>Mixing of GROUP columns (MIN(),MAX
ineer Safe Data, Inc.
> (910) 285-7200[EMAIL PROTECTED]
>
>
>
> -Original Message-
> From: Ananda Kumar [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 25, 2008 10:37 AM
> To: David Ruggles
> Cc: mysql
> Subject: Re: How do I (can I) use aggregate
David Ruggles wrote:
> I may be approaching this all wrong, but I need to know a percentage of
> total sales within a select statement.
>
> So I can do something like this:
> Select company, state, sales, sum(sales) / sales as percent
> From Sales
>
>
mmh, you want
sum(sales where compan
: Ananda Kumar [mailto:[EMAIL PROTECTED]
Sent: Friday, July 25, 2008 10:37 AM
To: David Ruggles
Cc: mysql
Subject: Re: How do I (can I) use aggregate functions inside a select
yes, u can use the below sql.
regards
anandkl
On 7/25/08, David Ruggles <[EMAIL PROTECTED]> wrote:
>
> I may be
yes, u can use the below sql.
regards
anandkl
On 7/25/08, David Ruggles <[EMAIL PROTECTED]> wrote:
>
> I may be approaching this all wrong, but I need to know a percentage of
> total sales within a select statement.
>
> So I can do something like this:
> Select company, state, sales, sum(sales)
I may be approaching this all wrong, but I need to know a percentage of
total sales within a select statement.
So I can do something like this:
Select company, state, sales, sum(sales) / sales as percent
>From Sales
Thanks,
David Ruggles
CCNA MCSE (NT) CNA A+
Network EngineerSafe Data,
Awesome!
Thanks Baron, works perfectly..
Phil
On Tue, Feb 26, 2008 at 10:06 PM, Baron Schwartz <[EMAIL PROTECTED]> wrote:
> Hi!
>
> On Tue, Feb 26, 2008 at 7:04 PM, Phil <[EMAIL PROTECTED]> wrote:
> > I have a table countrystats defined as
> >
> > CREATE TABLE IF NOT EXISTS `countrystats` (
>
Hi!
On Tue, Feb 26, 2008 at 7:04 PM, Phil <[EMAIL PROTECTED]> wrote:
> I have a table countrystats defined as
>
> CREATE TABLE IF NOT EXISTS `countrystats` (
> `proj` char(6) NOT NULL default '',
> `country` char(50) NOT NULL default '',
> `score` double default NULL,
> `nusers` int(11) d
I have a table countrystats defined as
CREATE TABLE IF NOT EXISTS `countrystats` (
`proj` char(6) NOT NULL default '',
`country` char(50) NOT NULL default '',
`score` double default NULL,
`nusers` int(11) default NULL,
`RAC` double default NULL,
`last_update` double default NULL,
PRI
: 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
L PROTECTED]
Sent: 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
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
max key value to be inserted in the table instead of
using the auto-increment (because it's rollback-unfriendly). However,
I wonder if using such expressions (I not using any other functions
except SQL Aggregate functions) in the select column-list would slow
down the INSERTs and wha
> I just noticed that MSAccess and SQL server support FIRST() and
> LAST()
> functions. Is there an equivalent in MySQL? My research
has come up
> with nil so far.
>
> Thanks,
>
> Michael
>
> Micha
how to "flatten" the result set of a join
> query using aggregate functions. For several fields
(b.refering_url,
> c.string, b.first_page, b.last_page) I need to pull out the
_first_ or
> _last_ item as ordered from the records returned from the join.
>
uery using aggregate functions. For several fields (b.refering_url,
c.string, b.first_page, b.last_page) I need to pull out the _first_ or
_last_ item as ordered from the records returned from the join.
However, I'm just lost for how this would be accomplished. I'd like
to say FIR
Hi there,
I am trying to figure out how to "flatten" the result set of a join
query using aggregate functions. For several fields (b.refering_url,
c.string, b.first_page, b.last_page) I need to pull out the _first_ or
_last_ item as ordered from the records returned from the join.
Thanks for that Nicolas.
Yasir
Can you run without the Order By at all? If not, you may need to
properly join the tables.
I could reproduce the issue with MySQL 4.1 as well and I would go around
it myself by creating a temporaty table, populating it with the
aggregate, doing a select on the
sday, March 08, 2006 11:10 PM
To: Dave Pullin
Cc: mysql@lists.mysql.com
Subject: Re: Aggregate functions in ORDER BY
Many thanks for that Dave.
Do you know whether it's possible for MySQL to return fully qualified
column names by default?
For example, I'd like
lto:[EMAIL PROTECTED]
Sent: Wednesday, March 08, 2006 11:10 PM
To: Dave Pullin
Cc: mysql@lists.mysql.com
Subject: Re: Aggregate functions in ORDER BY
Many thanks for that Dave.
Do you know whether it's possible for MySQL to return fully qualified
column names by default?
For ex
Can you run without the Order By at all? If not, you may need to
properly join the tables.
I could reproduce the issue with MySQL 4.1 as well and I would go around
it myself by creating a temporaty table, populating it with the
aggregate, doing a select on the temp table and then of course
from etc
order by count
) as subtable
Dave
-Original Message-
From: Yasir Assam [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 08, 2006 9:10 PM
To: mysql@lists.mysql.com
Subject: Aggregate functions in ORDER BY
Hello,
I noticed something strange in MySQL (I'm using 4.1.15).
I
bject: Aggregate functions in ORDER BY
Hello,
I noticed something strange in MySQL (I'm using 4.1.15).
If I use an aggregate function in the ORDER BY clause I get an error.
SELECT men.man_name,
COUNT(pets.pet_id)
FROM men,
pets
WHERE men.man_id = pets.pet_man_id
GROUP BY men.man_i
Hello,
I noticed something strange in MySQL (I'm using 4.1.15).
If I use an aggregate function in the ORDER BY clause I get an error.
SELECT men.man_name,
COUNT(pets.pet_id)
FROM men,
pets
WHERE men.man_id = pets.pet_man_id
GROUP BY men.man_id
ORDER BY COUNT(pets.pet_id) DESC;
4 - Unknown column
'maxid'
> in 'on clause'
>
> SELECT l.id, MAX(l.id) AS maxid, l.host_address, l2.firstname,
l2.lastname
> FROM `license` l
> INNER JOIN license l2 ON l2.id=maxid
> WHERE l.is_visible='1'
> GROUP BY l.host_address
> ORDER BY m
id=maxid
WHERE l.is_visible='1'
GROUP BY l.host_address
ORDER BY maxid DESC
Is there a way to do a join with the result of an aggregate function (in
this case MAX(id))
in one query, or do I have to use multiple queries for this?
Thanks in advance!
Guillaume
You cannot join on an aggr
='1'
GROUP BY l.host_address
ORDER BY maxid DESC
Is there a way to do a join with the result of an aggregate function (in
this case MAX(id))
in one query, or do I have to use multiple queries for this?
Thanks in advance!
Guillaume
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
ortunately, my job is to make it usable again. :-)
I'm trying to figure out a way to do this in one query (or at least not
have to send tons of queries over the network) but can't figure out how
to aggregate the results. I'd like to get a result similar to the
following:
+--
27; GROUP BY keyword HAVING
> COUNT(id) > $countFromPreviosQuery ORDER BY keyword;
>
> As you can imagine this makes the app very slow and nearly unusable.
> Unfortunately, my job is to make it usable again. :-)
>
> I'm trying to figure
g to figure out a way to do this in one query (or at least not
have to send tons of queries over the network) but can't figure out how
to aggregate the results. I'd like to get a result similar to the
following:
+
Administrator
Unimin Corporation - Spruce Pine
No there is not. Two options could be to either create an UDF or use a
programming language.
-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 5/25/04 1:25 PM
Subject: is there a PRODUCT() or MULTIPLY() aggregate function
No there is not. Two options could be to either create an UDF or use a
programming language.
-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 5/25/04 1:25 PM
Subject: is there a PRODUCT() or MULTIPLY() aggregate function?
Is there an aggregate function that
Is there an aggregate function that multiplies column values just like SUM()
adds them?
For instance, if "SELECT value FROM data" returns three values 2, 3, and 4,
then "SELECT PRODUCT(value) FROM data" would return 24, which is 2 * 3 * 4.
Thanks!
---
Fyodor Golos
Stockworm, Inc.
"Lou Olsten" <[EMAIL PROTECTED]> wrote:
> I'm in the process of trying to move some of our systems to MySQL from SQL Server and
> Oracle. At this point I'm learning and testing MySQL.
>
> One immediate question I have is regarding getting aggregate in
I'm in the process of trying to move some of our systems to MySQL from SQL Server and
Oracle. At this point I'm learning and testing MySQL.
One immediate question I have is regarding getting aggregate information. For
example, the SHOW DATABASES command would be an example of s
+--+
| isl_player |
+--+
| pla_id |
| pla_username |
+--+
+--+
| isl_login|
+--+
| pla_id |
| log_created |
+--+
+--+
| isl_transfer |
+--+
| pla_id |
| tra_amount |
+-
rning multiple rows in only one col to an aggregate function.
Thanks and bye,
Bernhard
- Original Message -
From: "Victoria Reznichenko" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 19, 2004 2:34 PM
Subject: Re: Subselect in aggregate function in My
work.
> Is it wrong by my design or is it MySQL design not to pass a subselect
> to an aggregate function?
>
If I've got you right you need:
SELECT AVG(anz) FROM (SELECT COUNT(time) anz FROM table GROUP BY time) as
table1;
--
For technical support contracts, goto https:
the
average number of requests per time.
I thus thought I can use a subselect like
SELECT AVG(SELECT COUNT(time) anz FROM table GROUP BY time) FROM table
That seems impossible, it in fact simply does not work.
Is it wrong by my design or is it MySQL design not to pass a subselect
to an aggregate
Dear colleagues!
I need to create my own aggregate UDF, so I decided to test UDF_example
from Windows MySQL source.
I've created udf_example.dll and udf_example.lib with VC++ 6.0.
Then, I haven't any problem with all of udf's, excepting the aggregate
udf avgcost.
On my "SELECT
Couldn't you also group by grouper2 and date2 ?
Something like:
...
GROUP BY grouper1, grouper2, date2
Just a hint I didn't test it.
On Thu, 2003-10-16 at 01:01, Travis Reeder wrote:
> I am trying to do an aggregate query, but having some problems and here
> the
I am trying to do an aggregate query, but having some problems and here
they are simplified:
Table1
date1
grouper1
x
Table2
date2
grouper2
y
Query is something like this:
SELECT SUM(x) as sum_x, SUM(y) as sum_y
FROM Table1
LEFT OUTER JOIN Table2 on grouper2 = grouper1
(date2 >= '2003-
ECTED]
Sent: Friday, May 30, 2003 4:57 PM
To: [EMAIL PROTECTED]
Subject: one query, two tables, two aggregate functions
Hi,
I would like to use one query to compare aggregate values from columns
in two separate tables. I am running mysql 3.23.55 (max). Here is a
simplified table structure:
Hi,
I would like to use one query to compare aggregate values from columns
in two separate tables. I am running mysql 3.23.55 (max). Here is a
simplified table structure:
job
- job_id
- name
quote
- quote_id
- job_id
- quote_amount
actual
- actual_id
- job_id
- actual_amount
I
>Description:
It appears that when an aggregate like MAX is used in a query, mysql will put
any
values in that it already has from internal statistics, however, this is wrong
if
the query being executed results in zero records, in this example, the MAX of
z
I'm having problems with vb.net and MySQL, only on reading records returned
with requests for functions, i.e., such as the following
SELECT max(field1) AS MaxValue FROM Table1
or
SELECT concat( field1, ' ', field2) as FullName FROM Table1
The queries work fine when executed directly from
Jay,
Tuesday, September 17, 2002, 10:45:51 PM, you wrote:
J> On my server the MySQL database decided to die on me. So I killed it and
J> restarted and that didn't work. So I just rebooted the machine. Now I'm
J> getting this error below.
J> Invalid SQL: SELECT COUNT(*) AS messages FROM privat
found by either query.
Inspect the data in these rows manually to determine what is wrong.
> -Original Message-
> From: Richard Unger [mailto:[EMAIL PROTECTED]]
> Sent: September 17, 2002 21:00
> To: [EMAIL PROTECTED]
> Subject: aggregate functions producing bad
Hi.
Could you run the following query:
SELECTIF(call_end - call_start > 5, id, NULL) AS long,
IF(call_end - call_start <= 5, id, NULL) AS short,
COUNT(*)
FROM t_calllog_calls
GROUP BY long, short
Given that I have not made any mistake, that should list all rows
whi
MySQL <-- to defeat the spam filter
-Original Message-
From: Richard Unger
Sent: Tuesday, September 17, 2002 1:46 PM
To: 'Dan Nelson'
Cc: [EMAIL PROTECTED]
Subject: RE: aggregate functions producing bad data
Thanks, I figured it out. It turns out there were some ca
PROTECTED]>
> To: "Richard Unger" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, September 17, 2002 10:16 PM
> Subject: Re: aggregate functions producing bad data
>
>
> > On Tue, Sep 17, 2002 at 11:59:42AM -0700, Richard Unger wrote:
> &
[EMAIL PROTECTED]
[EMAIL PROTECTED]
- Original Message -
From: "Brian Reichert" <[EMAIL PROTECTED]>
To: "Richard Unger" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, September 17, 2002 10:16 PM
Subject
ROTECTED]
- Original Message -
From: "Brian Reichert" <[EMAIL PROTECTED]>
To: "Richard Unger" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, September 17, 2002 10:16 PM
Subject: Re: aggregate functions producing bad data
> On Tue, Sep 17, 2002
On my server the MySQL database decided to die on me. So I killed it and
restarted and that didn't work. So I just rebooted the machine. Now I'm
getting this error below.
Invalid SQL: SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=1
mysql error: Can't open file: 'privatemessage.M
hard Unger
> Cc: [EMAIL PROTECTED]
> Subject: RE: aggregate functions producing bad data
>
>
> what does
> Select count(id) from t_calllog_calls where id IS NULL
> give you?
>
>
> On Tue, 17 Sep 2002, Richard Unger wrote:
>
> > That would just give m
> -Original Message-
> From: Dan Nelson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 17, 2002 12:31 PM
> To: Brian Reichert
> Cc: Richard Unger; [EMAIL PROTECTED]
> Subject: Re: aggregate functions producing bad data
>
>
> In the last episode (S
the total
>number of calls.
>
> Cheers,
> Rich
>
>
> > -Original Message-
> > From: Gelu Gogancea [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, September 17, 2002 12:08 PM
> > To: Richard Unger; [EMAIL PROTECTED]
> > Subject: Re: aggregate fun
In the last episode (Sep 17), Brian Reichert said:
> On Tue, Sep 17, 2002 at 11:59:42AM -0700, Richard Unger wrote:
> > My query:
> >
> > SELECT
> > count(id),
> > count( IF(call_end - call_start > 5, id, NULL) ),
> > count( IF(call_end - call_start <= 5, id, NULL) )
> > FROM
> >
id is the primary key. There are no entries in the DB where id=NULL
Cheers,
Rich
> -Original Message-
> From: Brian Reichert [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 17, 2002 12:16 PM
> To: Richard Unger
> Cc: [EMAIL PROTECTED]
> Subject: Re: aggregate f
ent: Tuesday, September 17, 2002 12:08 PM
> To: Richard Unger; [EMAIL PROTECTED]
> Subject: Re: aggregate functions producing bad data
>
>
> Hi,
> I think you should try to use 0 instead of NULL
>
> Regards,
>
> Gelu
> _
I _thought_ it was the fault of the aggregate function, but now I'm really confused!
When I produce them as 3 separate queries, I still get numbers that don't add up:
mysql> select count(id) from t_calllog_calls;
+---+
| count(id) |
+---+
| 1994 |
+
chard Unger" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 17, 2002 9:59 PM
Subject: aggregate functions producing bad data
My query:
SELECT
count(id),
count( IF(call_end - call_start > 5, id, NULL) ),
count( IF(call_end - call_start <= 5, id, NULL)
On Tue, Sep 17, 2002 at 11:59:42AM -0700, Richard Unger wrote:
> My query:
>
> SELECT
> count(id),
> count( IF(call_end - call_start > 5, id, NULL) ),
> count( IF(call_end - call_start <= 5, id, NULL) )
> FROM
> t_calllog_calls;
>
> My result:
>
> 1994
> 1956
> 35
>
My query:
SELECT
count(id),
count( IF(call_end - call_start > 5, id, NULL) ),
count( IF(call_end - call_start <= 5, id, NULL) )
FROM
t_calllog_calls;
My result:
1994
1956
35
However, 1956 + 35 != 1994.
Running MySQL 3.23.49-nt
Cheers,
Rich
---
Hi Eduardo,
I found the solution the left outer join + aggregate problem I had earlier
faced.
the query should be
SELECT p.nm_project, sum( dl.hours)
FROM PROJECT p LEFT OUTER JOIN DAYLOG dl ON (p.id_project =
dl.id_project
MySQL v3.23.49 linux
Hi,
We came across something strange here.
select count(*), user from mysql.user;
is illegal (ERROR 1140: Mixing of GROUP columns ... if there is no GROUP BY clause).
But,
select if( count(*) and user, 1, 0 ) from mysql.user;
actually works.
Is this a bug or
|
| To: manu manickalal/PRTGROUP|
| cc: |
| Subject: RES: Aggregate + left outer join |
>
Hi,
I am relatively new to MySQL.. I am having trouble getting an aggregate
function and an outer join to work together.
I have two tables
PROJECT (id_project, nm_project)
100, prj1
101, prj2
DAYLOG (id_project, date, hours)
100, 2002-08-17, 8
100, 2002-08-18, 8
DAYLOG table contains
I am having a or problem
reproducible by script below
(or by sql or by query if
mail filter likes those words
better:) ).
Briefly:
4 tables joined to each other:
/-ar
a
\-b-br
I would expect to get totals based on
the root record in a:
a_idq_a q_arq_b q_br
1 1 4
Kris,
Friday, June 07, 2002, 1:21:48 PM, you wrote:
KS> Sorry to bother the Guru's here, but I've recently started working on
KS> getting a mySQL database up and running and I noticed that some
KS> aggregate functions like MAX and MIN don't have 'DISTINCT' as an
Hi,
Sorry to bother the Guru's here, but I've recently started working on
getting a mySQL database up and running and I noticed that some
aggregate functions like MAX and MIN don't have 'DISTINCT' as an
optional arguement. Are these not supported or is this just missi
29.685196 |
> +---+
> 1 row in set (0.02 sec)
>
X
>
> > -Original Message-
> > From: Andrew Gould [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, May 11, 2002 7:51 AM
> > To: [EMAIL
1 - 100 of 129 matches
Mail list logo