码迷,mamicode.com
首页 > 其他好文 > 详细

多表查询 INNER JOIN ON WHERE

时间:2015-09-30 16:32:50      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

SELECT
ics.ID AS id,ics.YEAR AS year,ici.COURSE_NO AS courseId,
ics.COURSE_NAME_CN AS courseNameCn,ics.COURSE_NAME_EN AS courseNameEn,
ics.COURSE_MODULE_ID AS courseModuleId,ics.COURSE_MODULE_NAME_CN AS courseModuleNameCn,
ics.COURSE_MODULE_NAME_EN AS courseModuleNameEn,ics.CLASS_ROOM_ID AS classRoomId,
ics.CLASS_ROOM_NAME_CN AS classRoomNameCn,ics.CLASS_ROOM_NAME_EN AS classRoomNameEn,
ics.REGION_ID AS regionId,isi.CITY_ID AS cityId,ics.ID AS siteId,isi.SITE_NAME AS siteName,
ics.SITE_TYPE AS siteType,idi.ITEM_VALUE AS siteTypeNameCn,idi.ITEM_EN_VALUE as siteTypeNameEn,
ici.TYPE_ME_ID AS courseTypeId,icti.COURSE_TYPE_NAME AS courseTypeName,
ics.START_DATE AS startDate,ics.END_DATE AS endDate,ics.DAY_NUM AS dayNum ,
ics.TRAINER_ID AS trainer1Id,ics.TRAINER2_ID AS trainer2Id,ics.TRAINER3_ID AS trainer3Id,
ics.TRAINER4_ID AS trainer4Id,ics.TRAINER5_ID AS trainer5Id,ics.TRAINER6_ID AS trainer6Id,
ici.MAXIMUM_NUMBER AS maximumNumber
FROM
ICS_COURSE_SCHEDULE ics
INNER JOIN ICS_COURSE_INFO ici on ics.COURSE_ID = ici.ID
INNER JOIN ICS_SITE_INFO isi ON ics.site_id = isi.id
INNER JOIN ICS_DICT_ITEM idi ON ics.SITE_TYPE = idi.id
INNER JOIN ICS_COURSE_TYPE_INFO_ME icti ON ici.TYPE_ME_ID = icti.id


SELECT
sta.USERNAME
FROM
TRAINER tra
INNER JOIN STAFF sta ON tra.STAFF_ID = sta.ID
WHERE tra.ID=‘50e6981747281048c48b5fb1‘

多表查询 INNER JOIN ON WHERE

标签:

原文地址:http://www.cnblogs.com/AZZCS-0222/p/4849291.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!