Re: dump, drop database then merge/aggregate

2016-02-29 Thread Steven Siebert
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

Re: dump, drop database then merge/aggregate

2016-02-29 Thread Steven Siebert
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

Re: dump, drop database then merge/aggregate

2016-02-29 Thread Gary Smith
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

Re: dump, drop database then merge/aggregate

2016-02-29 Thread lejeczek
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

Re: dump, drop database then merge/aggregate

2016-02-29 Thread Steven Siebert
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

Re: dump, drop database then merge/aggregate

2016-02-29 Thread Johan De Meersman
- 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

Re: dump, drop database then merge/aggregate

2016-02-29 Thread lejeczek
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/

Re: dump, drop database then merge/aggregate

2016-02-29 Thread Gary Smith
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

Re: dump, drop database then merge/aggregate

2016-02-29 Thread lejeczek
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.

dump, drop database then merge/aggregate

2016-02-28 Thread lejeczek
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

Re: Why does a group_concat on a join change aggregate values?

2015-05-09 Thread hsv
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

Re: Why does a group_concat on a join change aggregate values?

2015-05-07 Thread Paul Halliday
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

Re: Why does a group_concat on a join change aggregate values?

2015-05-07 Thread Bob Eby
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.

Re: Why does a group_concat on a join change aggregate values?

2015-05-07 Thread shawn l.green
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

Why does a group_concat on a join change aggregate values?

2015-05-07 Thread Paul Halliday
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

RE: Aggregate

2012-09-22 Thread hsv
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

RE: Aggregate

2012-09-04 Thread hsv
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: Aggregate

2012-09-04 Thread Rick James
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

Aggregate

2012-08-31 Thread Ron Piggott
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

Aggregate Query

2011-11-18 Thread Nigel Peck
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

RE: Within-group aggregate query help please - customers and latest subscription row

2011-10-25 Thread Hal�sz S�ndor
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

RE: Within-group aggregate query help please - customers and latest subscription row

2011-10-24 Thread Daevid Vincent
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

RE: Within-group aggregate query help please - customers and latest subscription row

2011-10-24 Thread Daevid Vincent
- > 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

Within-group aggregate query help please - customers and latest subscription row

2011-10-24 Thread Daevid Vincent
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

Re: FW: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread Mr. Shawn H. Corey
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

FW: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread David Ruggles
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

RE: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread Jerry Schwartz
>-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

RE: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread Ian Simpson
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

Re: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread walter harms
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

RE: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread David Ruggles
: 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

Re: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread Ananda Kumar
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)

How do I (can I) use aggregate functions inside a select

2008-07-25 Thread David Ruggles
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,

Re: Insert...on duplicate with aggregate

2008-02-27 Thread Phil
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` ( >

Re: Insert...on duplicate with aggregate

2008-02-26 Thread Baron Schwartz
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

Insert...on duplicate with aggregate

2008-02-26 Thread Phil
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

RE: Updating two fields from an aggregate query

2006-09-26 Thread Robert DiFalco
: 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

Re: RE: Updating two fields from an aggregate query

2006-09-26 Thread Dan Buettner
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

Updating two fields from an aggregate query

2006-09-26 Thread Robert DiFalco
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

Re: Updating two fields from an aggregate query

2006-09-26 Thread Dan Buettner
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

Expressions, SQL Aggregate functions & SELECT Performance - index usage

2006-08-09 Thread Asif Lodhi
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

Re: Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
> 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

Re: Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
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. >

Re: Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
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

Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
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.

Re: Aggregate functions in ORDER BY

2006-03-09 Thread Yasir Assam
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

Re: Aggregate functions in ORDER BY

2006-03-09 Thread Yasir Assam
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

RE: Aggregate functions in ORDER BY

2006-03-09 Thread Dave Pullin
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

RE: Aggregate functions in ORDER BY

2006-03-08 Thread Nicolas Verhaeghe
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

Re: Aggregate functions in ORDER BY

2006-03-08 Thread Yasir Assam
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

RE: Aggregate functions in ORDER BY

2006-03-08 Thread Dave Pullin
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

Aggregate functions in ORDER BY

2006-03-08 Thread Yasir Assam
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;

Re: JOINs with result of aggregate function fails with error #1054

2006-02-21 Thread SGreen
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

Re: JOINs with result of aggregate function fails with error #1054

2006-02-21 Thread gerald_clark
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

JOINs with result of aggregate function fails with error #1054

2006-02-21 Thread Guillaume Boissiere
='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

how to use row total in aggregate query ?

2005-04-27 Thread Graham Anderson
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

Re: aggregate count and group by

2005-02-25 Thread Jim Grill
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: +--

Re: aggregate count and group by

2005-02-22 Thread SGreen
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

aggregate count and group by

2005-02-18 Thread Jim Grill
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: +

RE: is there a PRODUCT() or MULTIPLY() aggregate function?

2004-05-26 Thread SGreen
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

RE: is there a PRODUCT() or MULTIPLY() aggregate function?

2004-05-25 Thread Victor Pendleton
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 a PRODUCT() or MULTIPLY() aggregate function?

2004-05-25 Thread mysql
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.

Re: Getting Aggregate Object Data

2004-04-08 Thread Egor Egorov
"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

Getting Aggregate Object Data

2004-04-07 Thread Lou Olsten
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

2 joins + aggregate-functions

2004-04-07 Thread nicolas holzheu
+--+ | isl_player | +--+ | pla_id | | pla_username | +--+ +--+ | isl_login| +--+ | pla_id | | log_created | +--+ +--+ | isl_transfer | +--+ | pla_id | | tra_amount | +-

Re: Subselect in aggregate function in MySQL 4.1.1a-alpha

2004-02-21 Thread Bernhard Döbler
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

Re: Subselect in aggregate function in MySQL 4.1.1a-alpha

2004-02-19 Thread Victoria Reznichenko
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:

Subselect in aggregate function in MySQL 4.1.1a-alpha

2004-02-19 Thread programmer
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

Problem with aggregate UDF avgcost

2003-12-03 Thread Tamara Guseva
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

Re: tough sql joining and aggregate question

2003-10-16 Thread Diana Soares
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

tough sql joining and aggregate question

2003-10-15 Thread Travis Reeder
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-

RE: one query, two tables, two aggregate functions

2003-05-31 Thread David Shelley
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:

one query, two tables, two aggregate functions

2003-05-31 Thread Beau Hartshorne
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&#

invalid aggregate function value for 0 row results (from a full join)

2003-03-03 Thread root
>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

vb.net & aggregate MySQL functions

2002-10-02 Thread charlie
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

re: Re: aggregate functions producing bad data

2002-09-18 Thread Victoria Reznichenko
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

RE: aggregate functions producing bad data

2002-09-18 Thread Gerben Gieling
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

Re: aggregate functions producing bad data

2002-09-17 Thread Benjamin Pflugmann
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

FW: aggregate functions producing bad data

2002-09-17 Thread Richard Unger
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

Re: aggregate functions producing bad data

2002-09-17 Thread mtoth
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: > &

Re: aggregate functions producing bad data

2002-09-17 Thread Gelu Gogancea
[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

Re: aggregate functions producing bad data

2002-09-17 Thread Gelu Gogancea
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

Re: aggregate functions producing bad data

2002-09-17 Thread Jay
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

RE: aggregate functions producing bad data

2002-09-17 Thread Richard Unger
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

RE: aggregate functions producing bad data

2002-09-17 Thread Richard Unger
> -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

RE: aggregate functions producing bad data

2002-09-17 Thread mtoth
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

Re: aggregate functions producing bad data

2002-09-17 Thread Dan Nelson
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 > >

RE: aggregate functions producing bad data

2002-09-17 Thread Richard Unger
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

RE: aggregate functions producing bad data

2002-09-17 Thread Richard Unger
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 > _

RE: aggregate functions producing bad data

2002-09-17 Thread Richard Unger
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 | +

Re: aggregate functions producing bad data

2002-09-17 Thread Gelu Gogancea
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)

Re: aggregate functions producing bad data

2002-09-17 Thread Brian Reichert
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 >

aggregate functions producing bad data

2002-09-17 Thread Richard Unger
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 ---

Re: RES: Aggregate + left outer join (Solution)

2002-08-15 Thread mmanickalal
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

strange behaviour of aggregate functions in if() clauses

2002-08-13 Thread Martin Waite
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

Re: RES: Aggregate + left outer join

2002-08-09 Thread mmanickalal
| | To: manu manickalal/PRTGROUP| | cc: | | Subject: RES: Aggregate + left outer join | >

Aggregate + left outer join

2002-08-09 Thread mmanickalal
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

Multiple joins with aggregate problem

2002-07-23 Thread Yuri
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

Re: Aggregate functions

2002-06-07 Thread Egor Egorov
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

Aggregate functions

2002-06-07 Thread Kris Simonis
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

RE: geometric mean aggregate function

2002-05-13 Thread Andrew Gould
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   2   >