Re: [SQL] sql basic question

2012-12-28 Thread Andreas Kretschmer
Maybe something like: test=*# select * from foo; label | id | distance | side ---++--+-- 15 | 119006 | 0.10975569030617 |1 14 | 119006 | 0.11844830745091 |0 16 | 119006 | 0.17624040731777 |0 20 | 119006 | 0.39363711745035 |

Re: [SQL] sql basic question

2012-12-28 Thread Antonio Parrotta
Hello Andreas, apologize for the misunderstanding. Hope to clarify now. For each ID I want a min and max for each SIDE. I have about 160K records like this: label | id | distance | side ---++---+-- 15 | 119006 | 0.10975569030617 |

Fwd: Re: [SQL] sql basic question

2012-12-28 Thread Andreas Kretschmer
sorry, only a private replay and not to the list -- Ursprüngliche Nachricht -- Von: Andreas Kretschmer An: Antonio Parrotta Datum: 28. Dezember 2012 um 15:19 Betreff: Re: [SQL] sql basic question Hi, your question was: "What I want to achieve is a result table with min an

Re: [SQL] sql basic question

2012-12-28 Thread Antonio Parrotta
Hi Andreas, Anton, I did some test and both queries didn't worked. Maybe I was not clear with the example provided. My table contains more than 160K records with SIDE 0, 1, -1, 2, -2, 3 and -3. Example provided is a very small subset. *Andrea's *query is failing because it is getting only distinc

Re: [SQL] sql basic question

2012-12-28 Thread Anton Gavazuk
Antonio, but then you can do join between minmax select and source table by distance and get required columns... Thanks, Anton On Dec 28, 2012, at 12:43, Antonio Parrotta wrote: Hi Anton, I need column LABEL and ID as well. By grouping on SIDE these column cannot be included in the query.

Re: [SQL] sql basic question

2012-12-28 Thread Antonio Parrotta
Hi Anton, I need column LABEL and ID as well. By grouping on SIDE these column cannot be included in the query. Thanks - Antonio On 28 December 2012 12:38, Anton Gavazuk wrote: > Do the child Select min, max from... Group by side > > Then you can do whatever is required... > > Thanks, > Ant

Re: [SQL] sql basic question

2012-12-28 Thread Anton Gavazuk
Do the child Select min, max from... Group by side Then you can do whatever is required... Thanks, Anton On Dec 28, 2012, at 12:23, Antonio Parrotta wrote: Hi All, I have this table: LABEL ID Distance SIDE "15"; 119006; 0.10975569030617;1

[SQL] sql basic question

2012-12-28 Thread Antonio Parrotta
Hi All, I have this table: LABEL ID Distance SIDE "15"; 119006; 0.10975569030617;1 "14"; 64054;0.118448307450912; 0 "16"; 64055;0.176240407317772; 0 "20"; 64057;0.39363711745035;0 "19";