Переглянути джерело

sql manual: Example of conditions added

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@65874 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 9 роки тому
батько
коміт
ba80f7d376
1 змінених файлів з 12 додано та 0 видалено
  1. 12 0
      lib/db/sqlp/sql.html

+ 12 - 0
lib/db/sqlp/sql.html

@@ -187,6 +187,18 @@ v.db.update mygeodetic_pts col=zval \
 v.db.update vectormap column=column3 qcolumn="column1 || column2"
 </pre></div>
 
+<h3>Example of conditions</h3>
+
+Conditions (like if statements) are usually written as CASE statement in SQL:
+
+<div class="code"><pre>
+v.db.update vectormap column=species qcolumn="CASE WHEN col1 &gt;= 12 THEN cat else NULL end"
+
+# a more complex example with nested conditions
+v.db.update vectormap column=species qcolumn="CASE WHEN col1 &gt;= 1 THEN cat WHEN row = 13 then 0 ELSE NULL end"
+</pre></div>
+
+
 <h2>SEE ALSO</h2>
 
 <em>