Multiple fields in a table need to be associated with a dictionary table, how to write SQL query statements

Source: Internet
Author: User

Reference: https://bbs.csdn.net/topics/330032307

There is a dictionary table in the database, which contains the ID field and the corresponding name fields.
In another record table, there is a corresponding ID for the dictionary table above, and there are multiple fields that contain the ID field. It needs to be identified and used by name.

SELECTa.ID as 'numbering',' Story'  as 'type', A.title as 'title', B.name as 'Affiliated Projects', A.project as 'Affiliated Projects', C.realname as 'created by', A.estimate as 'Scheduled Time', D.realname as 'Responsibility Research', A.resolveddate as 'Actual resolution Time', A.closeddate as 'Actual shutdown Time', A.status fromzt_story A, zt_project B, Zt_user C, Zt_user DWHEREA.project=b.ID andA.openedby=C.account andA.assignedto=D.account anda.ID>=8650  anda.ID<= 8692ORDER  bya.idSELECTa.ID as 'numbering','BUG'  as 'type', A.title as 'title', B.name as 'Affiliated Projects', C.realname as 'created by', A.estimatedonedate as 'Scheduled Time', D.realname as 'Responsibility Research', A.resolveddate as 'Actual resolution Time', A.closeddate as 'Actual shutdown Time', A.status fromZt_bug A, zt_project B, Zt_user C, Zt_user DWHEREA.project=b.ID andA.openedby=C.account andA.assignedto=D.account anda.ID>=28095ORDER  bya.ID

Multiple fields in a table need to be associated with a dictionary table, how to write SQL query statements

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.