Aravintha Bashyam.c
Aravintha Bashyam.c

Reputation: 110

SQL:select values from two columns and display as one column

LATITUDE and LATITUDE are my two columns.

I have to combine these two columns into one column.

I have to combined these two columns as point values.

I tried this..,

SELECT `LATITUDE`, (LATITUDE) + ' ' + LONGITUDE+) AS point
FROM incident_google

but it is not working.

How to combine these two columns as one?

EX: LATITUDE= 38.8994816000000014,LONGITUDE=-76.9785097000000036

i need as

(38.8994816000000014,76.9785097000000036) as point

and say answer for this..,

thanks in advances.

Upvotes: 0

Views: 4845

Answers (4)

Anish V
Anish V

Reputation: 683

SELECT '(' + convert(varchar(50),LATITUDE) + ',' + convert(varchar(50),LONGITUDE) + ')' as Point FROM incident_google

Upvotes: 0

Soojoo
Soojoo

Reputation: 2156

Use as follows,

 SELECT LATITUDE, concat(LATITUDE,',' ,LONGITUDE) AS point FROM incident_google

Refer:http://www.tutorialspoint.com/mysql/mysql-concat-function.htm

Upvotes: 1

Mohan Raj B
Mohan Raj B

Reputation: 1026

In mysql

select CONCAT(LATITUDE, ",", LONGITUDE) as point FROM incident_google

Upvotes: 0

Ken Clark
Ken Clark

Reputation: 2530

Try this:

SELECT LATITUDE, '('+Convert(varchar(30),LATITUDE) + ',' + Convert(varchar(30),LONGITUDE)+')' AS point FROM incident_google

Upvotes: 0

Related Questions