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 已尽得俺真传了,老怀大慰啊...
|
|