Fuzzy query--View write SQL

Source: Internet
Author: User

"1" cip_admin_domain (option field a)---> Inside configuration (Option field a) property, Defalut_value set initial value (such as: Create a new project, the project status after creation is "pending approval")

Cip_admin_codes (option field a)

Note: Two fields in the table, and, front page code "option" field--"must be consistent,

"2" multi-conditional value function, in SQL

Select

field A, field B

(

Case

When (codes. Field 1 = ' option English alias 1 ') Then ' Chinese name 1 '

When (codes. Field 2 = ' option English alias 2 ') Then ' Chinese name 2 '

When (codes. Field 3 = ' option English alias 3 ') Then ' Chinese name 3 '

End

) as field a

From table where condition

Case:

--Simple case function case sex when         ' 1 ' then ' Male ' when         ' 2 ' then ' women ' else ' other ' END
----need to be aware of, the case function returns only the first qualifying value, and the remaining case section is automatically ignored.

--case search function Case if sex = ' 1 ' Then ' man ' when sex = ' 2 ' Then ' women ' else ' other ' END

"3" Select field A, field B,

' Cod '. ' Code_name ' as ' field alias ',----list displayed in Chinese
' Cod '. ' Code_type ' as ' field name ',-----The front page is an English alias (codes type)

From table name

Left JOIN ' cip_admin_codes ' to ' Cod ' on (
(
(
' m '. ' Project_scale ' = ' cod '. ' Code_type '
)
and (
' Cod '. ' domain_id ' = ' Project_scale '
)
)
)

Note: Front page, field list--"must be an alias.

Fuzzy query--View write SQL

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.