View previous topic :: View next topic |
Author |
Message |
sonika2008 Beginner
Joined: 17 Aug 2007 Posts: 20 Topics: 9
|
Posted: Tue Sep 18, 2007 8:01 am Post subject: How to get the output like (country,city)=(India,Hyd) in Sql |
|
|
Hi,
what should I use in SQL query that I get the output in this format:
(country,city) = (India,Hyd)
(country,City) = (India,Blgr) |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Tue Sep 18, 2007 8:13 am Post subject: |
|
|
sonika2008,
Do you have a table that contains the country and city values? If so post the sample table input
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
sonika2008 Beginner
Joined: 17 Aug 2007 Posts: 20 Topics: 9
|
Posted: Tue Sep 18, 2007 8:21 am Post subject: |
|
|
The table is like:-
Code: |
country city state
India Hyd AP
India BLR karnataka
India Pune Maharastra
|
This is just the sample table. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Tue Sep 18, 2007 8:29 am Post subject: |
|
|
sonika2008,
Try this
Code: |
SELECT CHAR('(COUNTRY,CITY) = (')
,COUNTRY || CHAR(',') || CITY || CHAR(')')
FROM Table
;
|
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
sonika2008 Beginner
Joined: 17 Aug 2007 Posts: 20 Topics: 9
|
Posted: Tue Sep 18, 2007 8:38 am Post subject: |
|
|
Thanks a lot!! |
|
Back to top |
|
 |
|
|