Mysql Variables & Branches

Source: Internet
Author: User

SELECT Case3 when1Then' One' when2Then' Both'ELSE' More'END; SELECT Case1>0Then'true'ELSE'false'END as' One', case0>0Then'true'ELSE'false'END as' Both'; SELECT Case BINARY'BB' when'a'Then1 when'BB'Then2END; SELECT Case'B' when'a'Then1 when'b'Then2END; SELECT IF (1>2,2,3);SelectSTRCMP ('Text2','text'); To use variables to hold the data, use the @ variable set @cq directly:= (SELECT a.id from emis.view1 A WHERE id =6); SELECT @cq as'how variable declarations are assigned'; SET @c= (SELECT a.printer_addr from emis.view1 A WHERE id =@cq); SELECT @c as'methods for assigning values to variable declarations @cq find'Note the above two assignment symbols, which can be used when set .= "or": = ", but must be used when using select": =Assignment "Select @bb:=id from emis.view1 A WHERE id =@cq; SELECT @bb;

Mysql Variables & Branches

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.