MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get the output like (country,city)=(India,Hyd) in Sql

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
sonika2008
Beginner


Joined: 17 Aug 2007
Posts: 20
Topics: 9

PostPosted: Tue Sep 18, 2007 8:01 am    Post subject: How to get the output like (country,city)=(India,Hyd) in Sql Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12382
Topics: 75
Location: San Jose

PostPosted: Tue Sep 18, 2007 8:13 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
sonika2008
Beginner


Joined: 17 Aug 2007
Posts: 20
Topics: 9

PostPosted: Tue Sep 18, 2007 8:21 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12382
Topics: 75
Location: San Jose

PostPosted: Tue Sep 18, 2007 8:29 am    Post subject: Reply with quote

sonika2008,

Try this

Code:

SELECT CHAR('(COUNTRY,CITY) = (')               
      ,COUNTRY || CHAR(',') || CITY || CHAR(')')
  FROM Table                                       
  ;         


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sonika2008
Beginner


Joined: 17 Aug 2007
Posts: 20
Topics: 9

PostPosted: Tue Sep 18, 2007 8:38 am    Post subject: Reply with quote

Thanks a lot!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group