示例如下:
select b_site.name as site_name,b_site.site_id," _
& " b_building.name as bl_name,b_building.bl_id," _
& " b_floot.name as fl_name,b_floot.fl_id," _
& " b_unit.name as unit_name,b_unit.unit_id," _
& " b_room.name as rm_name,b_room.rm_id, " _
& " d_maintain.apply_time,d_maintain.period," _
& " d_maintain.create_time,d_maintain.creator, " _
& " d_maintain.modify_time,d_maintain.modifier," _
& " d_maintain.maintain_id,d_maintain.description," _
& " b_custom.name as cm_name " _
& " from (((((b_room " _
& " INNER JOIN d_maintain ON b_room.rm_id = d_maintain.rm_id) " _
& " INNER JOIN b_building ON b_room.bl_id = b_building.bl_id) " _
& " INNER JOIN b_site ON b_room.site_id = b_site.site_id) " _
& " INNER JOIN b_custom ON b_custom.cm_id = b_custom.cm_id) " _
& " LEFT JOIN b_unit ON b_room.unit_id = b_unit.unit_id) " _
& " LEFT JOIN b_floot ON b_room.fl_id = b_floot.fl_id "
22 个解决方案
#1
沙沙沙........沙发......
#2
板板板........板凳......
#3
躺地上说 ,这不是VB中的语句,似乎不应该有引号 和连接符
#4
还有换行符
#5
谢谢楼上提醒了我.
select
b_site.name as site_name,b_site.site_id,
b_building.name as bl_name,b_building.bl_id,
b_floot.name as fl_name,b_floot.fl_id,
b_unit.name as unit_name,b_unit.unit_id,
b_room.name as rm_name,b_room.rm_id,
d_maintain.apply_time,d_maintain.period,
d_maintain.create_time,d_maintain.creator,
d_maintain.modify_time,d_maintain.modifier,
d_maintain.maintain_id,d_maintain.description,
b_custom.name as cm_name
from
(((((b_room as b_room INNER JOIN d_maintain as d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building as b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site as b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom as b_custom ON b_custom.cm_id = b_custom.cm_id)
LEFT JOIN b_unit as b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot as b_floot ON b_room.fl_id = b_floot.fl_id
#6
看红色部分,怎么一样了
select b_site.name as site_name
,b_site.site_id
,b_building.name as bl_name
,b_building.bl_id
,b_floot.name as fl_name
,b_floot.fl_id
,b_unit.name as unit_name
,b_unit.unit_id
,b_room.name as rm_name
,b_room.rm_id
,d_maintain.apply_time
,d_maintain.period
,d_maintain.create_time
,d_maintain.creator
,d_maintain.modify_time
,d_maintain.modifier
,d_maintain.maintain_id
,d_maintain.description
,b_custom.name as cm_name
from (((((b_room as b_room
INNER JOIN d_maintain as d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building as b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site as b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom as b_custom ON b_custom.cm_id = b_custom.cm_id)
LEFT JOIN b_unit as b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot as b_floot ON b_room.fl_id = b_floot.fl_id
select b_site.name as site_name
,b_site.site_id
,b_building.name as bl_name
,b_building.bl_id
,b_floot.name as fl_name
,b_floot.fl_id
,b_unit.name as unit_name
,b_unit.unit_id
,b_room.name as rm_name
,b_room.rm_id
,d_maintain.apply_time
,d_maintain.period
,d_maintain.create_time
,d_maintain.creator
,d_maintain.modify_time
,d_maintain.modifier
,d_maintain.maintain_id
,d_maintain.description
,b_custom.name as cm_name
from (((((b_room as b_room
INNER JOIN d_maintain as d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building as b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site as b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom as b_custom ON b_custom.cm_id = b_custom.cm_id)
LEFT JOIN b_unit as b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot as b_floot ON b_room.fl_id = b_floot.fl_id
#7
猜想
select b_site.name as site_name
,b_site.site_id
,b_building.name as bl_name
,b_building.bl_id
,b_floot.name as fl_name
,b_floot.fl_id
,b_unit.name as unit_name
,b_unit.unit_id
,b_room.name as rm_name
,b_room.rm_id
,d_maintain.apply_time
,d_maintain.period
,d_maintain.create_time
,d_maintain.creator
,d_maintain.modify_time
,d_maintain.modifier
,d_maintain.maintain_id
,d_maintain.description
,b_custom.name as cm_name
from (((((b_room as b_room
INNER JOIN d_maintain as d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building as b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site as b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom as b_custom ON b_room.cm_id = b_custom.cm_id)
LEFT JOIN b_unit as b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot as b_floot ON b_room.fl_id = b_floot.fl_id
#8
AA BB CC 都是一样的 3个字段 2行数据
这语句在sql2000 中可以执行
SELECT *
FROM AA INNER JOIN
BB ON BB.id = AA.id INNER JOIN
CC ON CC.id = AA.id
返回 2行 9列
而要达到同样的效果 在 Access中就变成这样
SELECT *
FROM aa INNER JOIN
(select * from bb INNER JOIN cc ON bb.id = cc.id ) as bbcc
on aa.id = bbcc.bb.id
楼主的语句有8个表 还有left join,
要改成这样的句式要晕死了,楼主自己来吧。
这语句在sql2000 中可以执行
SELECT *
FROM AA INNER JOIN
BB ON BB.id = AA.id INNER JOIN
CC ON CC.id = AA.id
返回 2行 9列
而要达到同样的效果 在 Access中就变成这样
SELECT *
FROM aa INNER JOIN
(select * from bb INNER JOIN cc ON bb.id = cc.id ) as bbcc
on aa.id = bbcc.bb.id
楼主的语句有8个表 还有left join,
要改成这样的句式要晕死了,楼主自己来吧。
#9
数错了,是7个表
#10
呵呵
Access 语句可以这样简化一下
SELECT *
FROM aa INNER JOIN (bb INNER JOIN
cc ON bb.id = cc.id )
on aa.id = bb.id
这样改起来就容易多了。
Access 语句可以这样简化一下
SELECT *
FROM aa INNER JOIN (bb INNER JOIN
cc ON bb.id = cc.id )
on aa.id = bb.id
这样改起来就容易多了。
#11
检查表名与字段是否有拼写错误
#12
谢谢娟,哈哈.还真是和那个问题有关系,去掉了之后可以正常执行了.
#13
看来是昨晚加班太晚..今天脑子里都是浆糊...
#14
可恶的西西,怎么给我起了个娟
#15
有时候书写格式也很重要,清晰明了的格式有助于减少错误
select b_site.name as site_name
,b_site.site_id
,b_building.name as bl_name
,b_building.bl_id
,b_floot.name as fl_name
,b_floot.fl_id
,b_unit.name as unit_name
,b_unit.unit_id
,b_room.name as rm_name
,b_room.rm_id
,d_maintain.apply_time
,d_maintain.period
,d_maintain.create_time
,d_maintain.creator
,d_maintain.modify_time
,d_maintain.modifier
,d_maintain.maintain_id
,d_maintain.description
,b_custom.name as cm_name
from (((((b_room as b_room
INNER JOIN d_maintain as d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building as b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site as b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom as b_custom ON b_room.cm_id = b_custom.cm_id)
LEFT JOIN b_unit as b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot as b_floot ON b_room.fl_id = b_floot.fl_id
#16
才发现这些语句是多余的 都是 xxx as xxx 这中句式
b_room as b_room = b_room
d_maintain as d_maintain = d_maintain
b_room as b_room = b_room
d_maintain as d_maintain = d_maintain
select b_site.name as site_name
,b_site.site_id
,b_building.name as bl_name
,b_building.bl_id
,b_floot.name as fl_name
,b_floot.fl_id
,b_unit.name as unit_name
,b_unit.unit_id
,b_room.name as rm_name
,b_room.rm_id
,d_maintain.apply_time
,d_maintain.period
,d_maintain.create_time
,d_maintain.creator
,d_maintain.modify_time
,d_maintain.modifier
,d_maintain.maintain_id
,d_maintain.description
,b_custom.name as cm_name
from (((((b_room
INNER JOIN d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom ON b_room.cm_id = b_custom.cm_id)
LEFT JOIN b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot ON b_room.fl_id = b_floot.fl_id
#17
加的那些as是由于我满脑子浆糊的状态下,找不到错误,到处瞎猜,于是那些as就出现了
#18
#19
留着贴子看看是否还有可能是其它原因造成"不支持连接表达式"这个现象,如果没有其他原因就结贴了.
#20
up jhone99
#21
问题已经解决了
#22
呵呵。
#1
沙沙沙........沙发......
#2
板板板........板凳......
#3
躺地上说 ,这不是VB中的语句,似乎不应该有引号 和连接符
#4
还有换行符
#5
谢谢楼上提醒了我.
select
b_site.name as site_name,b_site.site_id,
b_building.name as bl_name,b_building.bl_id,
b_floot.name as fl_name,b_floot.fl_id,
b_unit.name as unit_name,b_unit.unit_id,
b_room.name as rm_name,b_room.rm_id,
d_maintain.apply_time,d_maintain.period,
d_maintain.create_time,d_maintain.creator,
d_maintain.modify_time,d_maintain.modifier,
d_maintain.maintain_id,d_maintain.description,
b_custom.name as cm_name
from
(((((b_room as b_room INNER JOIN d_maintain as d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building as b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site as b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom as b_custom ON b_custom.cm_id = b_custom.cm_id)
LEFT JOIN b_unit as b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot as b_floot ON b_room.fl_id = b_floot.fl_id
#6
看红色部分,怎么一样了
select b_site.name as site_name
,b_site.site_id
,b_building.name as bl_name
,b_building.bl_id
,b_floot.name as fl_name
,b_floot.fl_id
,b_unit.name as unit_name
,b_unit.unit_id
,b_room.name as rm_name
,b_room.rm_id
,d_maintain.apply_time
,d_maintain.period
,d_maintain.create_time
,d_maintain.creator
,d_maintain.modify_time
,d_maintain.modifier
,d_maintain.maintain_id
,d_maintain.description
,b_custom.name as cm_name
from (((((b_room as b_room
INNER JOIN d_maintain as d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building as b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site as b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom as b_custom ON b_custom.cm_id = b_custom.cm_id)
LEFT JOIN b_unit as b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot as b_floot ON b_room.fl_id = b_floot.fl_id
select b_site.name as site_name
,b_site.site_id
,b_building.name as bl_name
,b_building.bl_id
,b_floot.name as fl_name
,b_floot.fl_id
,b_unit.name as unit_name
,b_unit.unit_id
,b_room.name as rm_name
,b_room.rm_id
,d_maintain.apply_time
,d_maintain.period
,d_maintain.create_time
,d_maintain.creator
,d_maintain.modify_time
,d_maintain.modifier
,d_maintain.maintain_id
,d_maintain.description
,b_custom.name as cm_name
from (((((b_room as b_room
INNER JOIN d_maintain as d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building as b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site as b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom as b_custom ON b_custom.cm_id = b_custom.cm_id)
LEFT JOIN b_unit as b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot as b_floot ON b_room.fl_id = b_floot.fl_id
#7
猜想
select b_site.name as site_name
,b_site.site_id
,b_building.name as bl_name
,b_building.bl_id
,b_floot.name as fl_name
,b_floot.fl_id
,b_unit.name as unit_name
,b_unit.unit_id
,b_room.name as rm_name
,b_room.rm_id
,d_maintain.apply_time
,d_maintain.period
,d_maintain.create_time
,d_maintain.creator
,d_maintain.modify_time
,d_maintain.modifier
,d_maintain.maintain_id
,d_maintain.description
,b_custom.name as cm_name
from (((((b_room as b_room
INNER JOIN d_maintain as d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building as b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site as b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom as b_custom ON b_room.cm_id = b_custom.cm_id)
LEFT JOIN b_unit as b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot as b_floot ON b_room.fl_id = b_floot.fl_id
#8
AA BB CC 都是一样的 3个字段 2行数据
这语句在sql2000 中可以执行
SELECT *
FROM AA INNER JOIN
BB ON BB.id = AA.id INNER JOIN
CC ON CC.id = AA.id
返回 2行 9列
而要达到同样的效果 在 Access中就变成这样
SELECT *
FROM aa INNER JOIN
(select * from bb INNER JOIN cc ON bb.id = cc.id ) as bbcc
on aa.id = bbcc.bb.id
楼主的语句有8个表 还有left join,
要改成这样的句式要晕死了,楼主自己来吧。
这语句在sql2000 中可以执行
SELECT *
FROM AA INNER JOIN
BB ON BB.id = AA.id INNER JOIN
CC ON CC.id = AA.id
返回 2行 9列
而要达到同样的效果 在 Access中就变成这样
SELECT *
FROM aa INNER JOIN
(select * from bb INNER JOIN cc ON bb.id = cc.id ) as bbcc
on aa.id = bbcc.bb.id
楼主的语句有8个表 还有left join,
要改成这样的句式要晕死了,楼主自己来吧。
#9
数错了,是7个表
#10
呵呵
Access 语句可以这样简化一下
SELECT *
FROM aa INNER JOIN (bb INNER JOIN
cc ON bb.id = cc.id )
on aa.id = bb.id
这样改起来就容易多了。
Access 语句可以这样简化一下
SELECT *
FROM aa INNER JOIN (bb INNER JOIN
cc ON bb.id = cc.id )
on aa.id = bb.id
这样改起来就容易多了。
#11
检查表名与字段是否有拼写错误
#12
谢谢娟,哈哈.还真是和那个问题有关系,去掉了之后可以正常执行了.
#13
看来是昨晚加班太晚..今天脑子里都是浆糊...
#14
可恶的西西,怎么给我起了个娟
#15
有时候书写格式也很重要,清晰明了的格式有助于减少错误
select b_site.name as site_name
,b_site.site_id
,b_building.name as bl_name
,b_building.bl_id
,b_floot.name as fl_name
,b_floot.fl_id
,b_unit.name as unit_name
,b_unit.unit_id
,b_room.name as rm_name
,b_room.rm_id
,d_maintain.apply_time
,d_maintain.period
,d_maintain.create_time
,d_maintain.creator
,d_maintain.modify_time
,d_maintain.modifier
,d_maintain.maintain_id
,d_maintain.description
,b_custom.name as cm_name
from (((((b_room as b_room
INNER JOIN d_maintain as d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building as b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site as b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom as b_custom ON b_room.cm_id = b_custom.cm_id)
LEFT JOIN b_unit as b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot as b_floot ON b_room.fl_id = b_floot.fl_id
#16
才发现这些语句是多余的 都是 xxx as xxx 这中句式
b_room as b_room = b_room
d_maintain as d_maintain = d_maintain
b_room as b_room = b_room
d_maintain as d_maintain = d_maintain
select b_site.name as site_name
,b_site.site_id
,b_building.name as bl_name
,b_building.bl_id
,b_floot.name as fl_name
,b_floot.fl_id
,b_unit.name as unit_name
,b_unit.unit_id
,b_room.name as rm_name
,b_room.rm_id
,d_maintain.apply_time
,d_maintain.period
,d_maintain.create_time
,d_maintain.creator
,d_maintain.modify_time
,d_maintain.modifier
,d_maintain.maintain_id
,d_maintain.description
,b_custom.name as cm_name
from (((((b_room
INNER JOIN d_maintain ON b_room.rm_id = d_maintain.rm_id)
INNER JOIN b_building ON b_room.bl_id = b_building.bl_id)
INNER JOIN b_site ON b_room.site_id = b_site.site_id)
INNER JOIN b_custom ON b_room.cm_id = b_custom.cm_id)
LEFT JOIN b_unit ON b_room.unit_id = b_unit.unit_id)
LEFT JOIN b_floot ON b_room.fl_id = b_floot.fl_id
#17
加的那些as是由于我满脑子浆糊的状态下,找不到错误,到处瞎猜,于是那些as就出现了
#18
#19
留着贴子看看是否还有可能是其它原因造成"不支持连接表达式"这个现象,如果没有其他原因就结贴了.
#20
up jhone99
#21
问题已经解决了
#22
呵呵。