一枚野生程序猿
2018-10-20 11:42
采纳率: 100%
浏览 968

Mysql FULL JOIN 遇到的一个语法错误;麻烦网友指教,谢谢!!

1、完整response:
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' full join (Orders o) on p.Id_p=o.Id_P LIMIT 0, 1000' at line 2

2、两个表:

Orders:

Id_O, OrderNo, Id_P

'3', '22456', '1'
'4', '24562', '1'
'2', '44678', '3'
'1', '77895', '3'
'5', '34764', '65'

Persons:

Id_p, LastName, FirstName, Address, City

'1', 'Adams', 'John', 'Oxford-Street', 'London'
'2', 'Bush', 'George', 'Fifth-Avenue', 'NewYork'
'3', 'Carter', 'Thomas', 'Changan-Street', 'Beijing'

3、查询语句:

select (p.FirstName, FirstName),(p.LastName, LastName),(o.OrderNo ,OrderNo)
from (Persons p)

full join (Orders o)
on p.Id_p=o.Id_P;

问题:
19:39:32 select (p.FirstName, FirstName),(p.LastName, LastName),(o.OrderNo ,OrderNo)
from (Persons p)

full join (Orders o)

on p.Id_p=o.Id_P
LIMIT 0, 1000

Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' full join (Orders o) on p.Id_p=o.Id_P LIMIT 0, 1000' at line 2 0.00031 sec

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • Bigmuu 2018-10-21 00:55
    已采纳

    mysql 不支持 FULL JOIN 用left join 或 right join 或者直接用笛卡儿积

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题