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 |
mrm23
Posting Yak Master
198 Posts |
Posted - 2008-07-30 : 06:53:03
|
Hi,I have a dropdown with one option as 'No Value' (This holds null)and 7 other options coming from tablenow, i want that "NoValue" to be at the beginning and the other 7 to be arranged in ascending order.The order by clause i used is not working since i have used UNION.So, is there any way in which i can get the desired o/p?Also, please suggest if this can be handled in the reporting tool itself.This is the query:[blue]select e.emp_seq_no val, e.emp_name label from employee e inner join project p on p.prj_gm_id = e.emp_seq_no UNION select 0 as val, 'No Value' as label **/blue]now i want the second query result(**) to be the first option andin the first query, the emp_name must be in ascending order. |
|
mrm23
Posting Yak Master
198 Posts |
Posted - 2008-07-30 : 08:27:01
|
hi,the issue iss resolved. here is the query:select a.val , a.label from (select e.emp_seq_no val, e.emp_name label from employee e inner join project p on p.prj_gm_seq_no = e.emp_seq_no union select 0 as val, 'No Value' as label) a order by case when a.label = 'No Value' then 1 else 2 end , a.labelThanks.... |
|
|
|
|
|