Query related records in the queried record set in SQL2000 (nested query)

Source: Internet
Author: User
In development, you sometimes need to query records with the symbol of the query condition in several fields, but you do not want to create a field to save the content of the field mentioned above. In the general method, it is to first query field 1, then query field 2, then query field 3, combine the content of the three fields, and then return to the customer.
In this way, I create a view_temp view based on the tables of these fields to temporarily process the table,
Select: Select Top 100 *
From (select Field 1 + Field 2 + Field 3 + field 4 as new field from view_temp) derivedtbl
Where new field like '% condition to be queried %'

Append one point:
The derivedtbl keyword must be added as long as the selection operation is performed from the result set. It is mainly used in multi-nested queries!
Continue:

I searched the internet. Here, derivedtbl only adds an alias to the subquery by the system. This can also be changed to another name!

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.