What s the query for ratio of 2 columns?

Posted by Oswaldlily under ASP.NET on 8/17/2011 | Points: 10 | Views : 1679 | Status : [Member] | Replies : 2
i HAVE COLUMN 1 AND COLUMN 2 IN DATABASE
COLUMN1->A,B,C,D,E
COLUMN2->1,2,3,4,5

NOW I NEED MY COLUMN 2 SHOULD BE COLUMN1:COLUMN2 (EG: A:1,B:2,C:3..)

HOW TO BRINIG THIS RAtio symbol in query..
I need sql query for this




Responses

Posted by: Dhirendra on: 8/17/2011 [Member] Starter | Points: 25

Up
0
Down
use this SQL if you want to join result of two columns with ratio(colon) symbol
select cast(column1 as varchar(25)) + ':' + column2 from table

if this is not you are looking for then write your question again with table name and output...
thanks

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A4u_6178 on: 8/17/2011 [Member] Starter | Points: 25

Up
0
Down
Hello @Dhirendra,

The query u have provided, I have modified it to get the required result
select cast(column1 as varchar(25)) + ':' + cast(column2 as varchar(25)) as Ratio  from table_name 



Thanks & Regards,

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response