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