{"id":94,"date":"2010-10-28T19:47:47","date_gmt":"2010-10-28T19:47:47","guid":{"rendered":"http:\/\/blog.yyhcw.com\/post\/94.html"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T07:54:17","slug":"","status":"publish","type":"post","link":"http:\/\/blog.yyhcw.com\/post\/94.html","title":{"rendered":"KesionCMS SQL\u6807\u7b7e\u4e2dIF\u6761\u4ef6\u8bed\u53e5\u4f7f\u7528\u8bf4\u660e\u4e4b\u4e00"},"content":{"rendered":"<p>&nbsp;\u3000\u3000\u8fd9\u51e0\u5929\u5728\u505a\u4e00\u4e2a\u7ad9\u7684\u65f6\u5019\u7528\u5230\u4e86\u79d1\u8bafsql\u6807\u7b7e\u4e2d\u7684if\u5224\u65ad\u8bed\u53e5\uff0c\u53ef\u662f\u7cfb\u7edf\u4e0b\u9762\u7684\u94fe\u63a5\u5730\u5740\u4e0d\u5bf9\uff0c\u6ca1\u529e\u6cd5\u4e86\u89e3\u8be6\u60c5\uff0c\u5728\u7f51\u4e0a\u627e\u4e86\u4e0b\u505a\u4e0b\u8bb0\u5f55\u4ee5\u5907\u540e\u7528\uff1a<\/p>\n<p><span class=\"Apple-style-span\" style=\"font-family: arial, helvetica, sans-serif; line-height: 24px; font-size: 14px; color: rgb(102, 102, 102); \"><\/p>\n<p style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 28px; \"><strong style=\"font-weight: bold; \">\u6807\u7b7e\u683c\u5f0f:<\/strong><\/p>\n<p style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 28px; \">{$IF(<font color=\"#ff0000\">condition<\/font>||<font color=\"#008000\">out1<\/font>||<font color=\"#0000ff\">out2<\/font>)}&nbsp;<\/p>\n<p style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 28px; \">\u6807\u7b7e\u8bf4\u660e\uff1a\u5f53\u6ee1\u8db3&nbsp;condition&nbsp;\u6761\u4ef6,\u8f93\u51faout1,\u5426\u5219\u8f93\u51fa&nbsp;out2,\u7c7b\u4f3cc,c#\u7b49\u8bed\u8a00\u91cc\u7684\u4e09\u5143\u8fd0\u7b97\u7b26a?b:c,\u9700\u8981\u6ce8\u610f\u7684\u65f6\u6bcf\u4e2a\u6761\u4ef6\u5bf9\u90fd\u5fc5\u987b\u5305\u542b\u4e24\u4e2a||&nbsp;<br \/>\ncondition\u53ef\u4ee5\u662f\u4efb\u4f55\u652f\u6301asp\u7684\u6761\u4ef6\u8fd0\u884c\u7b26\uff08\u5982=,\u3009,\u3008,\u3009=,\u3008=,\u3008\u3009\u7b49\uff09\u548c\u51fd\u6570\uff08\u5982datediff,isdate,isarray\u7b49\uff09<\/p>\n<p style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 28px; \">\u6ce8\u610f\u70b9\u8bf4\u660e:<\/p>\n<ol style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; \">\n<li style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; \"><font color=\"#800000\">\u8fd9\u4e2a\u6807\u7b7e\u53ea\u80fd\u5e94\u7528\u4e8esql\u6807\u7b7e\u7684\u5faa\u73af\u4f53\u4e2d,\u4e14\u4e0d\u80fd\u5d4c\u5957,\u4f46\u53ef\u4ee5\u5e73\u884c\u51fa\u73b0\u591a\u5bf9\u4f7f\u7528<\/font><\/li>\n<li style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; \"><font color=\"#800000\"><strong style=\"font-weight: bold; \">\u6807\u7b7e\u7684condition\u90e8\u5206\u5fc5\u987b\u662f\u4e25\u683c\u6309\u7167asp\u7684\u8bed\u6cd5\u4e66\u5199<br \/>\n    <\/strong><font color=\"#000000\">\u4e3e\u4f8b\u8bf4\u660e<br \/>\n    &nbsp;&nbsp;<font color=\"#ffffff\" style=\"background-color: rgb(255, 0, 0); \">a.\u5982\u6211\u4eec\u5e0c\u671b\u5b57\u6bb5intro(varchar\u7c7b\u578b)\u4e3a\u7a7a\u65f6,\u8f93\u51fa&quot;---&quot;,\u4e0d\u4e3a\u7a7a\u65f6,\u539f\u6587\u8f93\u51fa.&nbsp;<br \/>\n    <\/font>&nbsp;&nbsp;&nbsp;<strong style=\"font-weight: bold; \">\u6b63\u786e\u5199\u6cd51:<\/strong>&nbsp;<br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=\"#ff0000\">&quot;<\/font><font face=\"Verdana\">{$Field(intro,Text,0,...,0,<font color=\"#003300\">\u7a7a<\/font>)}<font color=\"#ff0000\">&quot;<\/font>=&quot;<font color=\"#333300\">\u7a7a<\/font>&quot;<br \/>\n    <strong style=\"font-weight: bold; \">&nbsp;&nbsp; \u6b63\u786e\u5199\u6cd52:<\/strong>&nbsp;<br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=\"#ff0000\">&quot;<\/font><font face=\"Verdana\">{$Field(intro,Text,0,...,0,)}<font color=\"#ff0000\">&quot;<\/font>=&quot;<font color=\"#333300\">&quot;<\/font><br \/>\n    <\/font><br \/>\n    &nbsp;&nbsp;&nbsp;<font color=\"#0000ff\">\u9519\u8bef\u5199\u6cd51:&nbsp;<\/font><br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana\">{$Field(intro,Text,0,...,0,<font color=\"#003300\">\u7a7a<\/font>)}=&quot;<font color=\"#008000\">\u7a7a<\/font>&quot;<br \/>\n    &nbsp;&nbsp;&nbsp;<font color=\"#0000ff\">\u9519\u8bef\u5199\u6cd52:<\/font>&nbsp;<br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana\">{&Scaron;Field(intro,Text,0,...,0,)}=&quot;\u7a7a&quot;<\/p>\n<p>    <\/font>\u5173\u952e\u5728\u4e8e\u4e0a\u9762\u52a0\u8272\u7684\u53cc\u5f15\u53f7\u662f\u5fc5\u987b\u7684,\u4e0d\u80fd\u5c11<br \/>\n    \u6bd4\u5982intro\u5b57\u6bb5\u4e3a &quot;kesion<a href=\"http:\/\/www.kesion.com\/\" target=\"_blank\" class=\"innerlink\" style=\"color: rgb(0, 0, 0); text-decoration: none; font-family: \u5fae\u8f6f\u96c5\u9ed1; outline-style: none; outline-width: initial; outline-color: initial; \">cms<\/a>&quot;,\u90a3\u4e48\u6211\u4eec\u53ef\u4ee5\u5c06\u4e0a\u9762\u7406\u89e3\u4e3a:<br \/>\n    <strong style=\"font-weight: bold; \">&nbsp; \u6b63\u786e\u5199\u6cd51:<\/strong>&nbsp;<br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=\"#ff0000\">&quot;kesion<a href=\"http:\/\/www.kesion.com\/\" target=\"_blank\" class=\"innerlink\" style=\"color: rgb(0, 0, 0); text-decoration: none; font-family: \u5fae\u8f6f\u96c5\u9ed1; outline-style: none; outline-width: initial; outline-color: initial; \">cms<\/a><\/font><font face=\"Verdana\"><font color=\"#ff0000\">&quot;<\/font>=&quot;<font color=\"#333300\">\u7a7a<\/font>&quot;<br \/>\n    <strong style=\"font-weight: bold; \">&nbsp;&nbsp; \u6b63\u786e\u5199\u6cd52:<\/strong>&nbsp;<br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=\"#ff0000\">&quot;kesion<a href=\"http:\/\/www.kesion.com\/\" target=\"_blank\" class=\"innerlink\" style=\"color: rgb(0, 0, 0); text-decoration: none; font-family: \u5fae\u8f6f\u96c5\u9ed1; outline-style: none; outline-width: initial; outline-color: initial; \">cms<\/a><\/font><font face=\"Verdana\"><font color=\"#ff0000\">&quot;<\/font>=&quot;<font color=\"#333300\">&quot;<\/font><br \/>\n    <\/font><br \/>\n    &nbsp;&nbsp;&nbsp;<font color=\"#0000ff\">\u9519\u8bef\u5199\u6cd51:&nbsp;<\/font><br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kesion<a href=\"http:\/\/www.kesion.com\/\" target=\"_blank\" class=\"innerlink\" style=\"color: rgb(0, 0, 0); text-decoration: none; font-family: \u5fae\u8f6f\u96c5\u9ed1; outline-style: none; outline-width: initial; outline-color: initial; \">cms<\/a><font face=\"Verdana\">=&quot;<font color=\"#008000\">\u7a7a<\/font>&quot;<br \/>\n    &nbsp;&nbsp;&nbsp;<font color=\"#0000ff\">\u9519\u8bef\u5199\u6cd52:<\/font>&nbsp;<br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kesion<a href=\"http:\/\/www.kesion.com\/\" target=\"_blank\" class=\"innerlink\" style=\"color: rgb(0, 0, 0); text-decoration: none; font-family: \u5fae\u8f6f\u96c5\u9ed1; outline-style: none; outline-width: initial; outline-color: initial; \">cms<\/a><font face=\"Verdana\">=&quot;\u7a7a&quot;<br \/>\n    \u8fd9\u6837\u5c31\u53ef\u4ee5\u6e05\u695a\u770b\u51fa,1,2\u79cd\u662f\u6b63\u786e\u5199\u6cd5,\u540e\u9762\u7684\u90fd\u662f\u9519\u8bef\u7684,\u5c11\u4e86\u53cc\u5f15\u53f7<br \/>\n    \u518d\u6bd4\u5982intro\u5b57\u6bb5\u4e3a\u7a7a\u65f6,\u5373\u6ca1\u6709\u5185\u5bb9.\u90a3\u4e48\u6211\u4eec\u53ef\u4ee5\u5c06\u4e0a\u9762\u7406\u89e3\u4e3a:<\/p>\n<p>    \u6b63\u786e\u5199\u6cd51:&nbsp;<br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=\"#ff0000\">&quot;\u7a7a<\/font><font face=\"Verdana\"><font color=\"#ff0000\">&quot;<\/font>=&quot;<font color=\"#333300\">\u7a7a<\/font>&quot;<br \/>\n    <strong style=\"font-weight: bold; \">&nbsp;&nbsp; \u6b63\u786e\u5199\u6cd52:<\/strong>&nbsp;<br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=\"#ff0000\">&quot;&quot;<\/font><font face=\"Verdana\">=&quot;<font color=\"#333300\">&quot;<\/font><br \/>\n    <\/font><br \/>\n    &nbsp;&nbsp;&nbsp;<font color=\"#0000ff\">\u9519\u8bef\u5199\u6cd51:&nbsp;<\/font><br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u7a7a<font face=\"Verdana\">=&quot;<font color=\"#008000\">\u7a7a<\/font>&quot;<br \/>\n    &nbsp;&nbsp;&nbsp;<font color=\"#0000ff\">\u9519\u8bef\u5199\u6cd52:<\/font>&nbsp;<br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana\">=&quot;\u7a7a&quot;<\/font><\/font><\/font><\/font><\/font><\/font><\/font><\/font><\/font><\/font><\/li>\n<li style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; \">&nbsp;<\/li>\n<li style=\"padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; \"><font color=\"#ffffff\" style=\"background-color: rgb(255, 0, 0); \">b.\u5982\u6211\u4eec\u5e0c\u671b\u6700\u6700\u8fd1\u4e09\u5929\u5185\u53d1\u5e03\u7684\u6587\u7ae0,\u8f93\u51fanew\u6807\u7b7e,\u65e5\u671f\u5b57\u6bb5\u4e3aAddDate(datetime\u7c7b\u578b).&nbsp;<br \/>\n    <\/font>&nbsp;&nbsp;<strong style=\"font-weight: bold; \">\u6b63\u786e\u5199\u6cd51:<\/strong>&nbsp;<br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana\">{$IF(datediff(&quot;d&quot;,<font color=\"#ff0000\">&quot;<\/font>{&Scaron;Field(adddate,Date,YYYY-MM-DD)}<font color=\"#ff0000\">&quot;,<\/font>now)&lt;3||<font color=\"#ff0000\"><b>new<\/b><\/font>||<font color=\"#cccccc\">{&Scaron;Field(adddate,Date,MM-DD)}<\/font>)}<br \/>\n    <\/font><font face=\"Verdana\"><font color=\"#0000ff\">\u9519\u8bef\u5199\u6cd5:&nbsp;<\/font><br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana\">&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana\">{$IF(datediff(&quot;d&quot;,{&Scaron;Field(adddate,Date,YYYY-MM-DD)},now)&lt;3||<font color=\"#ff0000\"><b>new<\/b><\/font>||<font color=\"#cccccc\">{&Scaron;Field(adddate,Date,MM-DD)}<\/font>)}<br \/>\n    \u5173\u952e\u8fd8\u662f\u4e0a\u9762\u7684\u53cc\u5f15\u53f7\u4e0d\u80fd\u5c11.\u5047\u8bbe\u6211\u4eec\u8fd9\u91cc\u7684adddate\u503c\u4e3a2009-3-10\u53f7,\u90a3\u4e48\u4ee5\u4e0a\u5c31\u8f6c\u53d8\u4e3a<\/p>\n<p>    <\/font><\/font><\/font>\u6b63\u786e:datediff(&quot;d&quot;,<font color=\"#ff0000\">&quot;2009-3-10&quot;<\/font><font color=\"#ff0000\">,<\/font>now)&lt;3&nbsp;&nbsp;&nbsp;&nbsp; ---\u7b26\u5408asp\u8bed\u6cd5<br \/>\n    \u9519\u8bef:datediff(&quot;d&quot;,<font color=\"#ff0000\">2009-3-10,<\/font>now)&lt;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ---\u4e0d\u7b26\u5408asp\u8bed\u6cd5<\/p>\n<p>\n    \u7ecf\u8fc7\u4ee5\u4e0a\u8bf4\u660e,\u6211\u60f3\u4f60\u4e5f\u5927\u6982\u660e\u767d\u4e86,\u4e3a\u4ec0\u4e48\u7ecf\u5e38\u4f1a\u5f97\u4e0d\u5230\u9884\u671f\u7684\u6548\u679c\u4e86,\u7279\u522b\u5e94\u8be5\u6ce8\u610f\u7684\u5c31\u662f\u7b2c\u4e8c\u70b9\u6761\u4ef6\u90e8\u5206\u7684\u5199\u6cd5,\u6bd4\u8f83\u6709\u8bb2\u7a76,\u5982\u679c\u662f\u6587\u672c\u578b\u5b57\u6bb5,\u6211\u4eec\u5f80\u5f80\u53ef\u4ee5\u52a0\u4e00\u4e2a&quot;\u7a7a&quot;\u5b57\u66ff\u4ee3\u3002<\/li>\n<\/ol>\n<p>\u8bb0\u5f55\u4e0b\uff0c\u4ee5\u540e\u518d\u9700\u8981\u7684\u65f6\u5019\u5c31\u4e0d\u7528\u5230\u5904\u627e\u4e86\uff01~<\/p>\n<p><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"&nbsp;\u3000\u3000\u8fd9\u51e0\u5929\u5728\u505a\u4e00\u4e2a\u7ad9\u7684\u65f6\u5019\u7528\u5230\u4e86\u79d1\u8bafsql\u6807\u7b7e\u4e2d\u7684if\u5224\u65ad\u8bed\u53e5\uff0c\u53ef\u662f\u7cfb\u7edf\u4e0b\u9762\u7684\u94fe\u63a5\u5730\u5740\u4e0d\u5bf9\uff0c\u6ca1\u529e\u6cd5 \u00b7\u00b7\u00b7","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"views":461,"_links":{"self":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts\/94"}],"collection":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/comments?post=94"}],"version-history":[{"count":0,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts\/94\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/media?parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/categories?post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/tags?post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}