Auswahl: gipfel.hoehe < 9999
OK: ok=1
Abfrage: SELECT gipfel.id,gipfel.name,gipfel.nr,gipfel.kanton,gipfel.hoehe,if(gipfel.nr in (662,744,777,1349,1507,1856,1995,2006,2168,2522,4385,4721,5031,5401,5619,5765,5973,5978,6264,6738,6750),gipfel.wo - 1,if(gipfel.nr in (106,431,453,517,562,1117,2025,2102,2423,2906,3103,4590,4706,5100,5534,5898,6112,6188,6266,6726),gipfel.wo + 1,gipfel.wo)) as wo,if(gipfel.nr in (96,491,501,557,744,1013,1485,1523,1589,1618,1788,1821,2458,2609,3103,4721,4970,5101,5190,5278,5534,5681,5683,5973,6006,6142,6481,6678,6680),gipfel.sn - 1,if(gipfel.nr in (183,251,428,750,776,1119,1480,1517,1536,2260,2422,2862,4588,4862,4926,5011,5765,6068),gipfel.sn + 1,gipfel.sn)) as sn, MIN(tourenbuch.datum) AS datum_von,MAX(tourenbuch.datum) AS datum_bis,COUNT(tourenbuch.datum) AS anz,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;