Easy Urgent Query Problem HELP!! 
Author Message
 Easy Urgent Query Problem HELP!!

Hi, I have an urgent query problem in SQLSERVER 6.5 ...

I have a query like :

select CulA, CulB from Table1

The result is :

CUlA           CulB
--------------------
  1             5
  2             6
  3             5
  4             6
  5             5

I want to show the result like this :

CUlA           CulB
--------------------
  1             CTRL
  2             DATA
  3             CTRL
  4             DATA
  5             CTRL

It is not allowed to create an extra table in the database !!

Please help me,

Regards,




Tue, 30 Sep 2003 14:37:31 GMT
 Easy Urgent Query Problem HELP!!

You can do this using the "CASE" statement, you won't need an extra table
either. Look in Books Online for "CASE", there are some good examples there.

Joe


Quote:
> Hi, I have an urgent query problem in SQLSERVER 6.5 ...

> I have a query like :

> select CulA, CulB from Table1

> The result is :

> CUlA           CulB
> --------------------
>   1             5
>   2             6
>   3             5
>   4             6
>   5             5

> I want to show the result like this :

> CUlA           CulB
> --------------------
>   1             CTRL
>   2             DATA
>   3             CTRL
>   4             DATA
>   5             CTRL

> It is not allowed to create an extra table in the database !!

> Please help me,

> Regards,





Tue, 30 Sep 2003 22:51:51 GMT
 Easy Urgent Query Problem HELP!!
select cula,culb=
case
 when culb=5 then 'CTRL'
 when culb=6 then 'DATA'
end
from table1


Quote:
> Hi, I have an urgent query problem in SQLSERVER 6.5 ...

> I have a query like :

> select CulA, CulB from Table1

> The result is :

> CUlA           CulB
> --------------------
>   1             5
>   2             6
>   3             5
>   4             6
>   5             5

> I want to show the result like this :

> CUlA           CulB
> --------------------
>   1             CTRL
>   2             DATA
>   3             CTRL
>   4             DATA
>   5             CTRL

> It is not allowed to create an extra table in the database !!

> Please help me,

> Regards,





Tue, 30 Sep 2003 16:36:25 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Easy Urgent Query problem HELP!!

2. Easy query problem, quick help needed please.

3. Urgent, query problem, pls help!!!

4. 3 easy problem i think, Help Help

5. HELP PLEASE: URGENT: Need help forming a multi table query

6. Problem Using DDE : URGENT URGENT URGENT

7. Insert Query Help!!!!!!!!EASY Question

8. query help, hard for me, I hope easy for you

9. Help: Designing For Easier Queries

10. HELP: How do I write this easy query?

11. Easy SQL question - query within query?

12. SQL-PROBLEMS - EASY FOR YOU - PLEASE HELP....


 
Powered by phpBB® Forum Software