由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - how to write this query
相关主题
问一个 SQL combine records问题新手请教几个sqlzoo上的问题
query analyzer VS. Stored procedure 如何在将学生成绩排序后,再加一个rank域
MSSQL 怎么解决内存是释放的问题?菜鸟求救:sql server 2000 启动
什么也不懂,要考个SQL Server 的证问个SQL的问题
servlet调用sql 访问oracle的问题SQL server 2000有hidden records吗?
请教一个SQL Query问Jackrun, Beijing等大侠performance问题
a problem, thank you在sql server 中存储中文的问题
query questions新手学习MS SQL请问一些问题。
相关话题的讨论汇总
话题: title话题: startdate话题: query话题: length
进入Database版参与讨论
1 (共1页)
m*****h
发帖数: 18
1
I have 2 tables, classes and classSchedules
Classes table has the following columns: ClassID, Title, Description, Length
, Price.
ClassSchedule table has ScheduleID, ClassID, StartDate.
I need a query to return the result shown below
Title Description StartDate Length Price
Class 1 desc. For Class 1 9/1/2008 5 days $1,000
c*****d
发帖数: 6045
2
没看懂

Length


【在 m*****h 的大作中提到】
: I have 2 tables, classes and classSchedules
: Classes table has the following columns: ClassID, Title, Description, Length
: , Price.
: ClassSchedule table has ScheduleID, ClassID, StartDate.
: I need a query to return the result shown below
: Title Description StartDate Length Price
: Class 1 desc. For Class 1 9/1/2008 5 days $1,000

m*****h
发帖数: 18
3
I want to return those columns Title, description, StartDate, Length, Price.
Since each class may have serveral different startDate. I don't want the
Title and description repeated in the result.
B*****g
发帖数: 34098
4
SELECT CASE c.ID
WHEN 1
THEN c.titel
ELSE NULL
END title,
CASE c.ID
WHEN 1
THEN c.description
ELSE NULL
END description,
c.startdate,
c.LENGTH,
c.price
FROM (SELECT a.titel,
a.description,
b.startdate,
a.LENGTH,
a.price,
ROW_NUMBER () OVER (PARTITION BY a.classid ORDER BY b.
scheduleid) ID
FROM classes a, classs

【在 m*****h 的大作中提到】
: I want to return those columns Title, description, StartDate, Length, Price.
: Since each class may have serveral different startDate. I don't want the
: Title and description repeated in the result.

w*r
发帖数: 2421
5
这种显示的问题应该在client端解决,你这个query要加上order by 才能显示正确

【在 B*****g 的大作中提到】
: SELECT CASE c.ID
: WHEN 1
: THEN c.titel
: ELSE NULL
: END title,
: CASE c.ID
: WHEN 1
: THEN c.description
: ELSE NULL
: END description,

B*****g
发帖数: 34098
6
没有啥应该不应该,lz要啥咱提供啥。要java, net咱也有,哈哈

【在 w*r 的大作中提到】
: 这种显示的问题应该在client端解决,你这个query要加上order by 才能显示正确
d*******8
发帖数: 3182
7
I need python and c

【在 B*****g 的大作中提到】
: 没有啥应该不应该,lz要啥咱提供啥。要java, net咱也有,哈哈
B*****g
发帖数: 34098
8
ding

【在 d*******8 的大作中提到】
: I need python and c
j*****n
发帖数: 1781
9
嗯,去living 版潜了几天水,回来发现beijing mm 已尽得俺真传了,老怀大慰啊...

【在 B*****g 的大作中提到】
: SELECT CASE c.ID
: WHEN 1
: THEN c.titel
: ELSE NULL
: END title,
: CASE c.ID
: WHEN 1
: THEN c.description
: ELSE NULL
: END description,

B*****g
发帖数: 34098
10
你这是打击报复,卡卡

【在 j*****n 的大作中提到】
: 嗯,去living 版潜了几天水,回来发现beijing mm 已尽得俺真传了,老怀大慰啊...
1 (共1页)
进入Database版参与讨论
相关主题
新手学习MS SQL请问一些问题。servlet调用sql 访问oracle的问题
windows xp home 下装mysql server, 如何能允许远程SSH访问?请教一个SQL Query
怎么样提高SQL SERVER的编程水平?a problem, thank you
有没有sql server的课程推荐query questions
问一个 SQL combine records问题新手请教几个sqlzoo上的问题
query analyzer VS. Stored procedure 如何在将学生成绩排序后,再加一个rank域
MSSQL 怎么解决内存是释放的问题?菜鸟求救:sql server 2000 启动
什么也不懂,要考个SQL Server 的证问个SQL的问题
相关话题的讨论汇总
话题: title话题: startdate话题: query话题: length