Topics Topics Help/Instructions Help Edit Profile Profile Member List Register Paatha Gnyapakaalu - Archives from Old DB  
Search New Posts 1 | 2 | 8 Hours Search New Posts 1 | 3 | 7 Days Search Search Tree View Tree View Latest tweets Live Tweets
Bewarse Talk Discussion Board * Archives - 2012 * SQL help urgent < Previous Next >

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Onlymovies
Mudiripoyina Bewarse
Username: Onlymovies

Post Number: 24635
Registered: 01-2009
Posted From: 199.173.226.236

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 1:10 pm:    Edit Post Delete Post View Post/Check IP


Stewie:


Thanks bhayya.. it worked..
SHER.. BABBAR SHER
Top of pagePrevious messageNext messageBottom of page Link to this message

Onlymovies
Mudiripoyina Bewarse
Username: Onlymovies

Post Number: 24634
Registered: 01-2009
Posted From: 199.173.226.236

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 12:59 pm:    Edit Post Delete Post View Post/Check IP


Stewie:


let ;me check this query..
SHER.. BABBAR SHER
Top of pagePrevious messageNext messageBottom of page Link to this message

Onlymovies
Mudiripoyina Bewarse
Username: Onlymovies

Post Number: 24633
Registered: 01-2009
Posted From: 199.173.226.236

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 12:59 pm:    Edit Post Delete Post View Post/Check IP


Gaali:

Employee table edi nee SQL lo?


first simple oka table lo data read cheyyataniki try chestunna.. online lo vunna examples mostly single table ki vunnayi.. first single table ki run chesi choosi, next multiple tables ki try cheddam ani.. aa query raasaanu.. danikee error vastundi...
SHER.. BABBAR SHER
Top of pagePrevious messageNext messageBottom of page Link to this message

Gaali
Celebrity Bewarse
Username: Gaali

Post Number: 27266
Registered: 03-2004
Posted From: 131.247.54.65

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 12:50 pm:    Edit Post Delete Post View Post/Check IP


Onlymovies:

select CNTCT_INFO_UID,
LISTAGG(EMAILADDR, '; ') WITHIN GROUP (ORDER BY EMAILADDR) "emails" from EMAIL




CLIPART--eyebrow_raised_in_disbelief Employee table edi nee SQL lo?
Top of pagePrevious messageNext messageBottom of page Link to this message

Stewie
Kurra Bewarse
Username: Stewie

Post Number: 1361
Registered: 03-2011
Posted From: 96.57.168.20

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 12:39 pm:    Edit Post Delete Post View Post/Check IP

select
employeeid ,
substr(SYS_CONNECT_BY_PATH(employeeid, ','),2) email_list
from
(
select
employeeid,
count(*) OVER ( partition by employeeid) cnt,
ROW_NUMBER () OVER ( partition by employeeid order by employeeid) seq
from email
)
where
seq=cnt
start with
seq=1
connect by prior
seq+1=seq
and prior
employeeid= employeeid;

idem ostondoo cheppu okasari
Patha Signature teeseysa
Top of pagePrevious messageNext messageBottom of page Link to this message

Onlymovies
Mudiripoyina Bewarse
Username: Onlymovies

Post Number: 24632
Registered: 01-2009
Posted From: 199.173.226.236

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 12:27 pm:    Edit Post Delete Post View Post/Check IP


Ravanabrahma:

google lo chodu thammi listagg syntax..evado okadu examples tho ichi untadu..

idi chodu use avuthundemo


Stewie bhayya ichina link lo vunnatte raasa query. still i am getting the same error.. search chesina taruvaate post vesaa..


select CNTCT_INFO_UID,
LISTAGG(EMAILADDR, '; ') WITHIN GROUP (ORDER BY EMAILADDR) "emails" from EMAIL

this is the quey i wrote.. order by emailaddr daggara error choopistundi..
'ORA-00923: FROM keyword not found where expected'
SHER.. BABBAR SHER
Top of pagePrevious messageNext messageBottom of page Link to this message

Stewie
Kurra Bewarse
Username: Stewie

Post Number: 1355
Registered: 03-2011
Posted From: 96.57.168.20

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:53 am:    Edit Post Delete Post View Post/Check IP


Ravanabrahma:

google lo chodu thammi listagg syntax


MOVIEART--bemmi.laugh

anduke nen munde link ichesa..
Patha Signature teeseysa
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Mudiripoyina Bewarse
Username: Ravanabrahma

Post Number: 19384
Registered: 06-2004
Posted From: 99.67.73.204

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:51 am:    Edit Post Delete Post View Post/Check IP


Onlymovies:

ORA-00923: FROM keyword not found where expected




google lo chodu thammi listagg syntax..evado okadu examples tho ichi untadu..

idi chodu use avuthundemo

http://docs.oracle.com/cd/E14072_01/server.112/e10592/functions087.htm
Top of pagePrevious messageNext messageBottom of page Link to this message

Onlymovies
Mudiripoyina Bewarse
Username: Onlymovies

Post Number: 24630
Registered: 01-2009
Posted From: 199.173.226.236

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:40 am:    Edit Post Delete Post View Post/Check IP


Ravanabrahma:


ORA-00923: FROM keyword not found where expected
SHER.. BABBAR SHER
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Mudiripoyina Bewarse
Username: Ravanabrahma

Post Number: 19383
Registered: 06-2004
Posted From: 99.67.73.204

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:38 am:    Edit Post Delete Post View Post/Check IP

try to use listagg function


select listagg(email, ',') within group (order by email)
from table1
where ......
Top of pagePrevious messageNext messageBottom of page Link to this message

Ferrari
Kurra Bewarse
Username: Ferrari

Post Number: 4919
Registered: 09-2010
Posted From: 75.149.150.97

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:36 am:    Edit Post Delete Post View Post/Check IP


Onlymovies:

Employee table
------------------------------------------
employeeid - empname
------------------------------------------
01 - sam
02 - john
------------------------------------------

Email table
------------------------------------------
employeeid - email
------------------------------------------
01 - sam1@email.com
01 - sam2@email.com
02 - john@email.com
------------------------------------------


I need result as
------------------------------------------
sam - sam1@email.com, sam2@email.com
john - john@email.com




yaa ardham ayyindi le annay...Stewie baa oka link ichaadu gaa adi follow ayipoooo
BTDB Rocks!!
Top of pagePrevious messageNext messageBottom of page Link to this message

Onlymovies
Mudiripoyina Bewarse
Username: Onlymovies

Post Number: 24629
Registered: 01-2009
Posted From: 199.173.226.236

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:34 am:    Edit Post Delete Post View Post/Check IP

Employee table
------------------------------------------
employeeid - empname
------------------------------------------
01 - sam
02 - john
------------------------------------------

Email table
------------------------------------------
employeeid - email
------------------------------------------
01 - sam1@email.com
01 - sam2@email.com
02 - john@email.com
------------------------------------------


I need result as
------------------------------------------
sam - sam1@email.com, sam2@email.com
john - john@email.com
SHER.. BABBAR SHER
Top of pagePrevious messageNext messageBottom of page Link to this message

Ferrari
Kurra Bewarse
Username: Ferrari

Post Number: 4916
Registered: 09-2010
Posted From: 75.149.150.97

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:30 am:    Edit Post Delete Post View Post/Check IP


Onlymovies:

email table lo emails same column lo vuntaayi...
emp id is FK to employee table., so we cannot do e2.email1, e2.email2...
:-(



swarry annay nenu wrong gaa interpret chesaanu nee kochen niMOVIEART--dv

stewie annay ichina link follow ayipoo
BTDB Rocks!!
Top of pagePrevious messageNext messageBottom of page Link to this message

Ferrari
Kurra Bewarse
Username: Ferrari

Post Number: 4915
Registered: 09-2010
Posted From: 75.149.150.97

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:27 am:    Edit Post Delete Post View Post/Check IP


Onlymovies:



konchem table lo data format ela undo example ivvu annay..neeku ye format lo kaavalo kooda cheppu
BTDB Rocks!!
Top of pagePrevious messageNext messageBottom of page Link to this message

Stewie
Kurra Bewarse
Username: Stewie

Post Number: 1354
Registered: 03-2011
Posted From: 96.57.168.20

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:27 am:    Edit Post Delete Post View Post/Check IP

Use the SYS_CONNECT_BY_PATH operator

http://www.dba-oracle.com/t_converting_rows_columns.htm
Patha Signature teeseysa
Top of pagePrevious messageNext messageBottom of page Link to this message

Onlymovies
Mudiripoyina Bewarse
Username: Onlymovies

Post Number: 24627
Registered: 01-2009
Posted From: 199.173.226.236

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:26 am:    Edit Post Delete Post View Post/Check IP


Ferrari:


email table lo emails same column lo vuntaayi...
emp id is FK to employee table., so we cannot do e2.email1, e2.email2...
:-(
SHER.. BABBAR SHER
Top of pagePrevious messageNext messageBottom of page Link to this message

Ferrari
Kurra Bewarse
Username: Ferrari

Post Number: 4914
Registered: 09-2010
Posted From: 75.149.150.97

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:24 am:    Edit Post Delete Post View Post/Check IP

i think ilaa raayochu anukuntaa

select e1.empid||'-'||e2.email1||','||e2.email2 from e1,e2 where e1.empid = e2.empid
MOVIEART--bemmi.adi
BTDB Rocks!!
Top of pagePrevious messageNext messageBottom of page Link to this message

Onlymovies
Mudiripoyina Bewarse
Username: Onlymovies

Post Number: 24626
Registered: 01-2009
Posted From: 199.173.226.236

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, March 14, 2012 - 10:19 am:    Edit Post Delete Post View Post/Check IP

I have a employee table, and have a email id table.

I can have multiple email id's for the same user.

Now I want to display all the users with their userid's (in the same column) like shown below

emp0 - email01, email02
emp1 - email11
emp2 -

can I do this using single SQL query?

if not how can I do that.. please suggest...
SHER.. BABBAR SHER

Topics | Last Hour | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration