select a.title,a.username,b.adddate from table a,
(select max(adddate) adddate from table where table.title=a.title) b问题这个是用了什么语法,后面from table a,这个后面是一个子查询,后面那个b有什么用啊。希望大虾帮帮忙,再次感谢!
8 回答

手掌心
TA贡献1942条经验 获得超3个赞
select a.title,a.username,b.adddate from table a, (select max(adddate) adddate from table where table.title=a.title) b
这是两种语法的合并
第一种
表连接
1 select title from table a,table b
第二种 表的别名
select max(adddate) adddate from table where table.title=a.title 代表 table b
select max(adddate) adddate from table where table.title=a.title 这是一个整体
剩下的不用说了吧

慕尼黑8549860
TA贡献1818条经验 获得超11个赞
select最基本的语法就是:
select 字段名 from 表名
给表取一个临时性的名字,可以这样写:
select 临时名.字段名 from 表名 as 临时名(有些人的习惯是把中间那个as省略掉,也是符合语法的)
你可以从整体看你的sql语句,然后再细看每一个部分。
就哪里(表)取什么数据(字段)

慕丝7291255
TA贡献1859条经验 获得超6个赞
b是给(select max(adddate) adddate from table where table.title=a.title)起的别名。
就像
他说的
}%`5[96`E4D)PD7T%8Q.jpg)
- 8 回答
- 0 关注
- 597 浏览
添加回答
举报
0/150
提交
取消