3 table deletions and 3 table queries in SQL statements

Source: Internet
Author: User

Long time did not come to our blog park, mainly in the recent busy some 7788 of the chores, including the preparation of playing badminton competition and their own learning Jqgrid confused. Do not pull these useless, I hope you can remember the younger brother, the younger brother thanked everyone here.

Return to the point: (The following SQL is I in the YII Framework development project when written, I hope to have some help)

The first is a multi-table query, in order to simplify I first post their own code, in the post-interpretation code.

Select A.*, b.*, c.*
From Rlzy_payfeeinf a INNER join Rlzy_personinfo b

On A.bid=b.bid join Rlzy_unit C

On A.bid =c.bid

Explanation: Rlzy_payfeeinf,rlzy_personinfo,rlzy_unit is a table name, and A,b,c is an alias. A.* represents all elements in the query Rlzy_payfeeinf.

Finally added: In fact, the join on the basis of adding a join on it

Next is the multiple table deletion:

Delete A,b,c
From Rlzy_payfeeinf A
Left JOIN Rlzy_personinfo b
On A.bid=b.bid left JOIN Rlzy_unit C
On A.bid=c.bid
where a.bid=1

DELETE A,b,c
From Rlzy_payfeeinf A
Left JOIN Rlzy_personinfo b
On A.bid=b.bid leftjoin rlzy_unit C
On A.bid=c.bid
WHERE a.bid=1

Explanation: In fact, the same as the query, only the middle of the key word left. In order to remind everyone to write the specification of SQL statement, deliberately added capitalization, to everyone as a learning problem, but just to warn everyone coding remember format, the keyword capital

Last: Update I won't say it first, because there is no case. But it's the same as this.

3 table deletions and 3 table queries in SQL 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.