首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

关于数据库分组解决方法

2012-05-28 
关于数据库分组创建语句:--创建食物信息表create table FoodInfo(id int identity primary key,foodCatego

关于数据库分组
创建语句:
--创建食物信息表
create table FoodInfo
(
id int identity primary key,
foodCategoryId int not null foreign key references FoodCategory(id),
foodName nvarchar(10) not null,
--在未使用之前先允许为null
price numeric(18,1),
[state] nvarchar(3) not null,
adminId char(20) not null foreign key references AdminInfo(id),
remarks text default '',
createTime datetime default getdate()
)


食物分类:



现在我想根据食物类别的名称进行分组:我写的语句如下:


[解决办法]
应该是你 FoodInfo.remarks 的问题,
如果你的FoodInfo.remarks内容不多的话,可以这样写 
....
group by ....., cast(FoodInfo.remarks as varchar(max)),....
..
[解决办法]

探讨
应该是你 FoodInfo.remarks 的问题,
如果你的FoodInfo.remarks内容不多的话,可以这样写
....
group by ....., cast(FoodInfo.remarks as varchar(max)),....
..

[解决办法]
探讨
创建语句:
--创建食物信息表
create table FoodInfo
(
id int identity primary key,
foodCategoryId int not null foreign key references FoodCategory(id),
foodName nvarchar(10) not null,
--在未使用之前先允许为null
pric……

热点排行
Bad Request.