SQL for multi-field summation and query

Source: Internet
Author: User
The following describes how to sum Multiple SQL fields and use them as SQL query conditions for your reference. I hope to help you learn SQL query. Make a small SQL query for field summation and query the results in a table where the sum of Field 1, Field 2, and field 3 is greater than 0. Therefore, write the following SQL statement. Note that the Where clause cannot contain

The following describes how to sum Multiple SQL fields and use them as SQL query conditions for your reference. I hope to help you learn SQL query. Make a small SQL query for field summation and query the results in a table where the sum of Field 1, Field 2, and field 3 is greater than 0. Therefore, write the following SQL statement. Note that the Where clause cannot contain

The following describes how to sum Multiple SQL fields and use them as SQL query conditions for your reference. I hope to help you learn SQL query.

Make a small SQL query for field summation and query the results in a table where the sum of Field 1, Field 2, and field 3 is greater than 0. Therefore, write the following SQL statement.

Note that, in the Where clause, fields obtained after self-calculation cannot exist.

Sqlstr = "select w. ID, W. weather, greenColor, (SELECT redColor + greenColor + blueColor FROM Weather n where n. ID = W. ID) AS AllValue FROM Weather w where (SELECT redColor + greenColor + blueColor FROM Weather n where n. ID = W. ID)> 0 order by id ";

That is, the following SQL statement does not work, saying "at least one parameter is not specified ".

Sqlstr = "select w. ID, W. weather, greenColor, (SELECT redColor + greenColor + blueColor FROM Weather n where n. ID = W. ID) AS AllValue FROM Weather w where AllValue> 0 order by id ";

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.