|
TwojePC.pl © 2001 - 2025
|
 |
A R C H I W A L N A W I A D O M O Ś Ć |
 |
| |
|
PostgresSQL i kwerenda , AwerS 18/10/07 16:20 Witam mam następujący problem mam jedna tabele z polami:
1 other_benchmarks random_1000_10_v2 Simulation 115
1 other_benchmarks if_nested_5x15_v3 Simulation 107
1 other_benchmarks case_nested_15x15_v2 Simulation 35
1 other_benchmarks shifter Simulation 146
1 other_benchmarks or_nr010 Simulation 147
1 other_benchmarks rising_1000_10_v2 Simulation 240
1 other_benchmarks clk_v3 Simulation 345
1 other_benchmarks if_nested_8x15 Simulation 119
1 other_benchmarks random_1000_100_v3 Simulation 196
1 other_benchmarks serial_200000 Simulation 144
1 other_benchmarks case_nested_4x16_v2 Simulation 76
1 other_benchmarks rising_1000_100_v2 Simulation 151
1 other_benchmarks or_nr100 Simulation 232
1 other_benchmarks rising_1000_1_v2 Simulation 198
1 other_benchmarks falling_1000_100_v3 Simulation 158
1 other_benchmarks shifter_non-zero Simulation 75
1 other_benchmarks case Simulation 167
1 other_benchmarks if_nested_15x15_v2 Simulation 115
2 other_benchmarks random_1000_20_v2 Simulation 225
2 other_benchmarks if_nested_5x25_v3 Simulation 207
2 other_benchmarks case_nested_25x25_v2 Simulation 35
2 other_benchmarks shifter Simulation 246
2 other_benchmarks or_nr020 Simulation 247
2 other_benchmarks rising_2000_20_v2 Simulation 240
2 other_benchmarks rising_2000_200_v2 Simulation 252
2 other_benchmarks or_nr200 Simulation 232
2 other_benchmarks rising_2000_2_v2 Simulation 298
2 other_benchmarks falling_2000_200_v3 Simulation 258
2 other_benchmarks shifter_non-zero Simulation 75
2 other_benchmarks case Simulation 267
2 other_benchmarks if_nested_25x25_v2 Simulation 212
i chcialbym otrzymac wynik w postaci :
other_benchmarks random_1000_10_v2 Simulation 115 225
other_benchmarks if_nested_5x15_v3 Simulation 107 207
.
.
.
.
other_benchmarks clk_v3 Simulation 345 null
.
.
.
other_benchmarks if_nested_15x15_v2 Simulation 115 212
A problem jak na przykładzie polega na dopisani ostatniej kolumny do wyniki gdzie wszystkie pola występują.AwerS - za diabła , Wedrowiec 18/10/07 16:41
nie mogę zrozumieć o co Ci chodzi :)"Widziałem podręczniki
Gdzie jest czarno na białym
Że jesteście po**bani" - ja chyba zrozumialem , Holyboy 18/10/07 17:54
if_nested_5 - wystepuje 2 razy, rozni sie wartoscia po 'x' - dane zgadzaja sie
pytanie ile jest tych rekordow?Strength is irrelevant.
Resistance is futile.
We wish to improve ourselves. - Juz tlumacze , AwerS 18/10/07 21:06
warunek ma byc nastepujace jezeli kolumna 2,3,4 taka sama to dopisz z rekordu co ma wartosc 2 czyli na przykladzie
kolumna1 kolumna2 kolumna3 kolumna4 wartosc1
kolumna1 kolumna2 kolumna3 kolumna4 wartosc2
kolumna1 kolumna2 kolumna3 kolumna4 wartosc3
kolumna1 kolumna2 kolumna3 kolumna4 wartosc2
wynik
kolumna1 kolumna2 kolumna3 kolumna4 wartosc 1wartosc2
jezeli kolumny od 1 do 4 maja takie same wartosci przyklad:
kolumna1=kolumna1 kolumna2=kolumna2 ....
jezeli wystepuje taka wartosc ze nie ma odpowiednika to powinna byc wyswietlona jako null
kolumna1 kolumna2 kolumna3 kolumna4 wartosc 1null.
Pozdrawiam chyba troszke wyjasnilem chodzi o takiego duzego join'a tylko ze na jednej tabeli :)AwerS
- musisz , Holyboy 18/10/07 18:19
znalezc wszystkie reguly dla 3 kolumny
nastepnie piszesz funkcje ktora
dla rekordu 1 other_benchmarks if_nested_5x15_v3 Simulation 107
przyjmuje parametry 1 i if_nested_5 (regula w tym przypadku to branie z 3 kolumny tego co przed x), wartosc ostatnie i szuka odpowiedniego rekordu z drugiej serii a potem wstawia do nowej tabeli gotowe rekordy wynikoweStrength is irrelevant.
Resistance is futile.
We wish to improve ourselves. - hmmm , Holyboy 18/10/07 22:26
zlaczenie to dobry pomysl, ale nadal cos krecisz - z ta kolumna1 - przeciez w niej masz numer zestawu wynikow... i z ta kolumna 4 - przeciez w niej masz wynik badania - a te jak widac z przykladu sa rozne - z tego co podales na przykladzie to istotna jest kolumna 3, byc moze 2 i 4 tez (ale tego nie widac w podanym zestawie)
SELECT t1.*, t2.kolumna4 FROM tabela t1 LEFT JOIN tabela t2 ON (t1.kol1 = t2.kol1 AND t1.kol2 = t2.kol2 AND t1.kol3 = t2.kol3 AND t2.zestaw_wynikow = 2);
w mysqlu cos podobnego dziala.... nie chce mi sie robic tabeli w postgresie...
ile masz rekordow w tej tabeli?Strength is irrelevant.
Resistance is futile.
We wish to improve ourselves. - moja kwerenda wyglada tak , AwerS 19/10/07 09:54
SELECT
public.compare.id,
public.compare.to_do_id,
public.machine_name.name as machine,
public.compare.machine_id as mach_id,
public.group_name.name as group_name,
public.compare.group_id as group_id,
public.benchmark.name as benchmark,
public.compare.bench_id as bench_id,
public.param.name as param_name,
public.compare.param_id as param_id,
public.compare.val_param as value
FROM
public.compare
INNER JOIN public.machine_name ON (public.compare.machine_id = public.machine_name.id)
INNER JOIN public.group_name ON (public.compare.group_id = public.group_name.id)
INNER JOIN public.benchmark ON (public.compare.bench_id = public.benchmark.id)
INNER JOIN public.param ON (public.compare.param_id = public.param.id)
WHERE
public.compare.to_do_id = 125 AND public.param.id= '2' AND
public.compare.id BETWEEN
(SELECT to_do.compare_begin_id FROM to_do WHERE id=125)
AND
(SELECT to_do.comapre_end_id FROM to_do WHERE id=125) ;
ostatnia sekcja between mowi gdzie szukac w tabeli compare wynikow dla to_do_id 125 (tabela ma pare milionow rekordow) i teraz chodzi o zrobienie tego join'a ktory do dolaczonej tabeli bedzie mial inne to_do_id wiec bedzie trzeba podac widelki do wyszukania jego pozycji w tabeli.AwerS
|
|
|
|
 |
All rights reserved ® Copyright and Design 2001-2025, TwojePC.PL |
 |
|
|
|