|
查看: 1256|回复: 3
|
MSSQL 2000 的问题
[复制链接]
|
|
|
在我的那个 MSSQL 2000 的数据库里。
有一个问题想了好旧都想不到怎样去 SOLVE THE PROBLEM。
请个为前辈帮帮小弟。谢谢。
Table name = XXX
Column name = resAttendees
resAttendees
============
,AAA,,BBB,,
不知要怎样才可以 COUNT 有多少个 Attendees 呢?
AAA = 1 个 Attendee
BBB = 1 个 Attendee
[ 本帖最后由 shinchanawang 于 12-6-2007 10:51 AM 编辑 ] |
|
|
|
|
|
|
|
|
|
|
发表于 12-6-2007 12:21 PM
|
显示全部楼层
回复 #1 shinchanawang 的帖子
你可以用function 来算有多少个 attendees
For example:
create Function get_Attendess (@resAttendess varchar)
returns int
as
Begin
Declare @iCount int;
...logic to parse @resAttendess and count the number of attendees
return @iCount
End
然后用select statement call function.
select get_Attendess(resAttendees) from XXX;
不过我看到这样的table design, 我就想晕  |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 13-6-2007 09:45 AM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 15-6-2007 10:09 PM
|
显示全部楼层
呵呵!我也面对这如此让人头晕的table结构:
customerid, item1, item1_desc, item2, item2_desc 一直到 item20, item20_desc
通常table的entries都是打直的嘛,鸡蛋糕UK鬼佬把它弄成打横的…… >< |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|