Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-11-29 : 17:00:48
|
jason writes "I'm trying to get the top 5 values for two tables, order by sched_date "datetest".
Like
select distinct(convert(varchar(8), u.sched_date,1)) as datetest, ltrim(rtrim(right(ltrim(rtrim(convert(varchar(20), u.sched_start_time, 100))), 8))) as Timetest, cast(datediff(n, u.sched_start_time, u.sched_end_time)as decimal)/60 as Durationtest from user_wfm_sched u where u.sched_state = 1 and u.wfm_user_id = 'userid' union select distinct(convert(varchar(8), u.sched_date,1)) as datetest, ltrim(rtrim(right(ltrim(rtrim(convert(varchar(20), u.sched_start_time, 100))), 8))) as Timetest, cast(datediff(n, u.sched_start_time, u.sched_end_time)as decimal)/60 as Durationtest from group_wfm_sched u, user_kdev uk, user_user_group us where us.user_kdev_user_id='userid' and uk.user_id=us.user_kdev_user_id and u.sched_state=1
This does bring back the records correctly but can I get the top five from this list? I'm very confused. I don't want to have to use a view." |
|
|
|
|
|
|
|