avatar
how to write this query# Database - 数据库
m*h
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
avatar
c*d
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

avatar
m*h
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.
avatar
B*g
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.

avatar
w*r
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,

avatar
B*g
6
没有啥应该不应该,lz要啥咱提供啥。要java, net咱也有,哈哈

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

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

【在 d*******8 的大作中提到】
: I need python and c
avatar
j*n
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,

avatar
B*g
10
你这是打击报复,卡卡

【在 j*****n 的大作中提到】
: 嗯,去living 版潜了几天水,回来发现beijing mm 已尽得俺真传了,老怀大慰啊...
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。