Re: grouping by the difference between values in rows

2014-01-21 Thread Takeshi Hashimoto
For me, it seems just use [case - when ] on the difference between x and y, and group by with output. Good luck *\(^o^)/* Sent from my iPhone On Jan 21, 2014, at 15:38, h...@tbbs.net wrote: > 2014/01/12 14:17 -0500, Larry Martell > I've been asked to do something that I do not think

Re: grouping by the difference between values in rows

2014-01-21 Thread hsv
2014/01/12 14:17 -0500, Larry Martell I've been asked to do something that I do not think is possible in SQL. I have a query that has this basic form: SELECT a, b, c, d, AVG(e), STD(e), CONCAT(x, ',', y) as f FROM t GROUP BY a, b, c, d, f x and y are numbers (378.18, 2213.797 or 378.21

Re: grouping by the difference between values in rows

2014-01-15 Thread Larry Martell
incorporates that result column? >>> >>> I thought of temp tables, but I could not come up with a way to use >>> them for this. How can I apply the x/y tolerance grouping in sql? >> >> >> Run the query you showed, saving the result to a temp table

Re: grouping by the difference between values in rows

2014-01-15 Thread shawn l.green
ch space (your plane is defined by your {a,b,c,d} tuple) acceptable results of your re-grouping process? If I had to draw this out graphically, you are stamping each of your {x,y} points with a 2x2 boundary box (each point is in intersection in the middle) and you want to know which sets of thos

Re: grouping by the difference between values in rows

2014-01-13 Thread Larry Martell
On Mon, Jan 13, 2014 at 2:43 AM, Peter Brawley wrote: > > On 2014-01-12 9:13 PM, Larry Martell wrote: >> >> On Sun, Jan 12, 2014 at 2:47 PM, Peter Brawley >> wrote: >>> >>> On 2014-01-12 1:17 PM, Larry Martell wrote: I've been asked to do something that I do not think is possible in SQL

Re: grouping by the difference between values in rows

2014-01-12 Thread Peter Brawley
On 2014-01-12 9:13 PM, Larry Martell wrote: On Sun, Jan 12, 2014 at 2:47 PM, Peter Brawley wrote: On 2014-01-12 1:17 PM, Larry Martell wrote: I've been asked to do something that I do not think is possible in SQL. I have a query that has this basic form: SELECT a, b, c, d, AVG(e), STD(e), C

Re: grouping by the difference between values in rows

2014-01-12 Thread Larry Martell
On Sun, Jan 12, 2014 at 2:47 PM, Peter Brawley wrote: > On 2014-01-12 1:17 PM, Larry Martell wrote: >> >> I've been asked to do something that I do not think is possible in SQL. >> >> I have a query that has this basic form: >> >> SELECT a, b, c, d, AVG(e), STD(e), CONCAT(x, ',', y) as f >> FROM t

Re: grouping by the difference between values in rows

2014-01-12 Thread Peter Brawley
On 2014-01-12 1:17 PM, Larry Martell wrote: I've been asked to do something that I do not think is possible in SQL. I have a query that has this basic form: SELECT a, b, c, d, AVG(e), STD(e), CONCAT(x, ',', y) as f FROM t GROUP BY a, b, c, d, f x and y are numbers (378.18, 2213.797 or 378.218,

Re: grouping and limiting results and rand()

2013-09-23 Thread Peter Brawley
On 2013-09-23 8:10 PM, Jeremiah Jester wrote: Hello, How would i go about selecting 5 random cars that are flagged as internet_special (value 1) for each dealer from a specific table? Ive tried sub selects with no luck. Here's a basic query that has my required conditional. Note that I get all

Re: grouping

2007-11-03 Thread Brent Baisley
It sounds to me like you might be trying to find the standard deviation or the variance, which are functions you can use right in your query. On Nov 2, 2007, at 7:37 AM, Octavian Rasnita wrote: Hi, I have a table with the following columns: symbol date value I want to select all the sym

Re: grouping

2007-11-02 Thread Baron Schwartz
Hi, Octavian Rasnita wrote: Hi, I have a table with the following columns: symbol date value I want to select all the symbols (grouping by symbols) between 2 specified dates, and calculate the percent of change for each symbol. The percent of change is (the value from the last date of the

Re: Grouping Question

2007-04-22 Thread YL
Thanks a lot CJ. That's the cost of flexibility:-) - Original Message - From: Christian High To: YL Cc: mysql@lists.mysql.com Sent: Sunday, April 22, 2007 12:45 PM Subject: Re: Grouping Question On 4/22/07, YL <[EMAIL PROTECTED]> wrote: I have a co

Re: Grouping Question

2007-04-22 Thread Christian High
On 4/22/07, Christian High <[EMAIL PROTECTED]> wrote: On 4/22/07, YL <[EMAIL PROTECTED]> wrote: > > I have a contact table looks like > > id type owner_idowner_type value > 11email21 person [EMAIL PROTECTED] > 12phone 21

Re: Grouping Question

2007-04-22 Thread Christian High
On 4/22/07, YL <[EMAIL PROTECTED]> wrote: I have a contact table looks like id type owner_idowner_type value 11email21 person [EMAIL PROTECTED] 12phone 21 person 303-777- 13PO Box18

Re: grouping

2007-02-10 Thread Peter Brawley
>select column1, column2, max(column3) as maximum >from table_name group by column 1; >Please tell me if the values from "column2" will contain the values from >those records where the column3 has the maximum value. They will not. >please tell me how to do this as fast as possible. What's fast

Re: Grouping based on state changes

2004-09-22 Thread SGreen
I think all you need is a GROUP BY. Here is a tutorial sample from the manual: http://dev.mysql.com/doc/mysql/en/Counting_rows.html Here is page that describes the full SELECT syntax, including GROUP BY http://dev.mysql.com/doc/mysql/en/SELECT.html And here are all of the other functions you can

Re: Grouping based on state changes

2004-09-22 Thread Michael Stassen
Use GROUP BY: SELECT state, AVG(value) FROM yourtable GROUP BY state; See the manual for all the details . Michael [EMAIL PROTECTED] wrote: I have the following table definition for time series data: ID (int) time (DATETIME)sta

RE: grouping / sorting etc..

2003-07-14 Thread Christopher Knight
Thanks for everybody's help!! This way worked for me. Clever! Chris ... and yes... even my example was messed up :-P -Original Message- From: Rudy Metzger [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 4:15 AM To: Christopher Knight; MySQL List Subject: RE: grouping / so

Re: grouping / sorting etc..

2003-07-14 Thread Krasimir_Slaveykov
Hello Christopher, Friday, July 11, 2003, 6:31:33 PM, you wrote: First select: The results are just right what you want in your SELECT. You have 5 different values in COLUMN1 and your select returns them. >From second column SELECT gets first value for each value of first column. Second select:

RE: grouping / sorting etc..

2003-07-14 Thread Rudy Metzger
SELECT col1, IF(count(*)!=count(col2),NULL,'BAD') FROM table1 GROUP BY col1; This ONLY works EXACLTY for the case you submitted. Please note that your example is wrong (I think). 3 should also return NULL, shouldn't it? /rudy -Original Message- From: Christopher Knight [mailto:[EMA

Re: Grouping behavior question

2001-11-01 Thread Anvar Hussain K.M.
Hi Mr. Jerry, Since Mysql does not support sub query, you will have to use temporary table instead. Create temporary table tmptbl1 Select keycol, Max(datetimecol) as maxdate from detailtable group by Keycol; Create temporary table tmptbl2 Select distinct T.Keycol, D.Status from tmptbl1 T, de

RE: GROUPING

2001-05-30 Thread Olivier Georg
Hola Rodrigo, I suggest that you use a temporary table: CREATE tmp ( INT id, TIME max); INSERT INTO tmp SELECT mytable.id, MAX(mytable.start) FROM mytable GROUP BY mytable.id; and then join it to your original table: SELECT M.* FROM mytable M, tmp T WHERE M.id=T.id AND M.start=T.max;

RE: GROUPING

2001-05-30 Thread Ravi Raman
: Wednesday, May 30, 2001 11:41 AM To: Ravi Raman; [EMAIL PROTECTED] Subject: Re: GROUPING I did this, but there is a problem I have to select all fields from the record returned, not just id and start, i need the other fields from the record with max start do you understand? - Original

Re: GROUPING

2001-05-30 Thread Rodrigo Gonzalez
igo Gonzalez" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, May 30, 2001 12:37 PM Subject: RE: GROUPING > hi. > > select id, max(start) from your_table group by id; > > HTH. > -ravi. > > -Original Message- > From: Rodrigo Gonzalez [mailto

RE: GROUPING

2001-05-30 Thread Ravi Raman
hi. select id, max(start) from your_table group by id; HTH. -ravi. -Original Message- From: Rodrigo Gonzalez [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 30, 2001 10:57 AM To: [EMAIL PROTECTED] Subject: GROUPING Hi, I have to do a query but i don't know how to do this... I have t

RE: GROUPing question

2001-02-05 Thread Ung, Seng
Bob: In case if you don't know this just want you to know... Out of all the messages that I received, I only read your and saved it for the future. thank you.. seng - Before posting, please check: http://www.mysql.com/m

Re: GROUPing question

2001-02-02 Thread Bob Hall
>I have a GROUPing question on the following query: > >SELECT HOUR(closedtime) AS hour, COUNT(assignedto) AS count FROM db WHERE >(closedtime >='2001-01-01' AND closedtime <= '2001-01-31 23:59:59') AND >assignedto='person' GROUP BY hour; > >give something like this: > >+--++---