{"id":3067,"date":"2020-07-09T14:14:51","date_gmt":"2020-07-09T13:14:51","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=3067"},"modified":"2022-02-17T07:13:47","modified_gmt":"2022-02-17T07:13:47","slug":"ternary-operator-if","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/mysql\/queries\/select\/ternary-operator-if","title":{"rendered":"Ternary Operator if( , , )"},"content":{"rendered":"\n<p>if(Condition, ConditionIsTrue, ConditionIsNotTrue)<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">SELECT depending on condition<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>select if(3 &lt; 5,'Condition is true','Condition is not true') as ConditionalResult<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">UPDATE depending on condition<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">Example &#8211; Increment value if below # or reset to 1<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\"UPDATE MyTable SET\n  MyValueA = 1,\n  MyValueB = if(MyValueB &lt; 65535, MyValueB + 1, 1) \n WHERE Something = 5\"<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>if(Condition, ConditionIsTrue, ConditionIsNotTrue) SELECT depending on condition UPDATE depending on condition Example &#8211; Increment value if below # or reset to 1<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64,240],"tags":[],"class_list":["post-3067","post","type-post","status-publish","format-standard","hentry","category-select","category-update-queries"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3067","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=3067"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3067\/revisions"}],"predecessor-version":[{"id":3071,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3067\/revisions\/3071"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=3067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=3067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=3067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}