Mercurial > dive4elements > river
changeset 6536:c155f8f57b7e
Initial improved query to find matching cross section.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 03 Jul 2013 16:09:51 +0200 |
parents | 8a425ee702e3 |
children | f2722602936c |
files | backend/src/main/java/org/dive4elements/river/model/CrossSection.java |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/model/CrossSection.java Wed Jul 03 12:09:05 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/CrossSection.java Wed Jul 03 16:09:51 2013 +0200 @@ -53,6 +53,16 @@ "km between :from_km AND :to_km " + "ORDER BY csl.km, csl.id, csp.col_pos"; + public static final String SQL_MIN_MAX = + "SELECT * FROM ( "+ + "SELECT cross_section_id, MIN(km) AS minkm, MAX(km) AS maxkm " + + "FROM cross_section_lines " + + "WHERE cross_section_id IN " + + " (SELECT id FROM cross_sections WHERE river_id = :river_id) " + + " GROUP BY cross_section_id" + + ") AS cs_ranges WHERE :km BETWEEN minkm AND maxkm ORDER BY :km - minkm "; + // Order by time interval missing. + private Integer id; private River river; private TimeInterval timeInterval;