25-10000 first SQL数据库别名用法
--sort 表 分类表 create table Sort( ID int identity(1,1), Title nvarchar(50) not null, Name nvarchar(200) null, ImgUrl varchar(100) null, Content nvarchar(max) null, ViewCount int not null, Type int not null, CreateTime Datetime not null, primary Key(ID), ); go select * from Sort; --查询sort表中 字段为标题2 的值内容。 为sort表起别名为p.然后用别名去点字段,就可以查询对应字段名字了。 --别名语法 select p.Title from Sort AS p where p.Title='标题2'; --查询sort表中字段名字为李四的值数据 select p.Name from Sort AS p where p.Name='李四';
效果: