Add a field to the result during SQL SELECT statement query,

Source: Internet
Author: User

To avoid table join queries, you need to add a field to the SQL statement results:

The original SQL statement is:

Select C. * From (select rownum as R, B. * From (select T ., T ., T ., T ., T ., t. user_id_encrypt, T ., t. create_time, T ., T ., T ., a. user_type from t_wiki_doc_posts t inner join t_wiki_user A on T. user_id_encrypt =. user_id_encrypt where doc_topics_id_encrypt = 'baarerlfz, x0nyx1oca, 1ldvw'
Order by create_time) B where rownum <= 20) c Where C. R> = 1

To:

Select C. * From (select rownum as R, B. * From (select T ., T ., T ., T ., T ., t. user_id_encrypt, T ., t. create_time, T ., T ., T .,0 as user_typeFrom t_wiki_doc_posts t where doc_topics_id_encrypt = 'jranb?wa1fea0bga0ajxa **'
Order by create_time) B where rownum <= 20) c Where C. R> = 1

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.