Auswahl: gipfel.hoehe < 9999
OK: ok=1
Abfrage: SELECT gipfel.id,gipfel.name,gipfel.nr,gipfel.kanton,gipfel.hoehe,if(gipfel.nr in ( 2, 28, 157, 292, 304, 372, 393, 396, 482, 610, 662, 699, 710, 744, 745, 777, 997,1044,1065,1141,1234,1349,1376,1396,1422,1457,1507,1524,1585,1689,1856,1586,1888,1995,2000,2006,2033,2042,2066,2087,2152,2168,2217,2231,2512,2522,2575,2631,2671,2714,2737,2748,2791,3166,3294,4385,4386,4418,4721,4778,4985,4996,5031,5200,5401,5423,5542,5619,5669,5765,5841,5920,5972,5973,5978,5983,6108,6264,6392,6616,6738,6750),gipfel.wo - 1,if(gipfel.nr in ( 106, 216, 257, 431, 453, 463, 517, 562, 651, 704, 921, 933,1117,1140,1270,1474,1483,1547,1590,1615,1692,1765,1785,1814,1830,1872,2025,2037,2043,2068,2102,2144,2392,2395,2423,2550,2559,2699,2733,2770,2824,2906,3086,3103,3147,3184,3189,3215,3253,4042,4365,4429,4449,4522,4589,4590,4706,4784,4952,4971,5087,5091,5100,5186,5391,5437,5534,5631,5806,5871,5898,6112,6116,6188,6266,6481,6630,6650,6683,6726,6740,6756),gipfel.wo + 1,gipfel.wo)) as wo,if(gipfel.nr in ( 96, 200, 222, 388, 491, 501, 557, 609, 694, 744, 949,1013,1143,1151,1463,1485,1523,1548,1589,1618,1788,1792,1821,1830,1833,1861,1891,2015,2069,2099,2104,2223,2315,2340,2388,2458,2470,2508,2605,2609,2713,2847,2903,3103,3293,3788,4303,4329,4339,4366,4376,4379,4520,4572,4582,4716,4721,4741,4742,4895,4916,4970,5101,5190,5234,5257,5278,5283,5449,5452,5534,5669,5681,5683,5779,5973,5997,6006,6031,6142,6658,6678,6680),gipfel.sn - 1,if(gipfel.nr in ( 83, 127, 166, 183, 251, 428, 460, 472, 539, 575, 672, 750, 776,1064,1119,1125,1135,1210,1343,1480,1496,1517,1645,1688,1784,2001,2026,2054,2208,2260,2077,2087,2197,2367,2422,2441,2449,2509,2678,2862,2863,3130,3833,4317,4352,4386,4483,4588,4659,4580,4660,4862,4926,5011,5119,5299,5404,5413,5485,5552,5698,5765,5792,5919,6058,6068,6090,6098,6632),gipfel.sn + 1,gipfel.sn)) as sn, MIN(tourenbuch.datum) AS datum_von,MAX(tourenbuch.datum) AS datum_bis,COUNT(tourenbuch.datum) AS anz,min(art) as minart,max(art) as maxart,if(tourenbuch.datum IS NULL,0,1) AS ok FROM gipfel AS gipfel LEFT JOIN tourenbuch AS tourenbuch ON tourenbuch.nr=gipfel.nr GROUP BY gipfel.nr HAVING ok=1 OR gipfel.hoehe < 9999 ORDER BY wo,sn,ok desc,gipfel.hoehe DESC,gipfel.nr;