dbTalk Databases Forums  

Query Question

comp.databases.oracle.server comp.databases.oracle.server


Discuss Query Question in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mtek
 
Posts: n/a

Default Query Question - 06-19-2008 , 12:42 PM







Hi,

Is it possible to return all rows from a query on one line?

I have this query:

SELECT cnt || ':' || t_id
FROM (SELECT COUNT(*) cnt, t_id
FROM zc_body zb, zc_type zt
WHERE zb.t_id = zt.id
group by t_id);

It returns data like this:

86:3
994:7
99:18
38:27
45:36

However, they want it in one line: 86:3,994:7,99:18,38:27,45:36

Can this be done?

Thanks!

John


Reply With Quote
  #2  
Old   
Shakespeare
 
Posts: n/a

Default Re: Query Question - 06-19-2008 , 01:10 PM







"Mtek" <mtek (AT) mtekusa (DOT) com> schreef in bericht
news:c80264dd-be17-4754-a00e-483b4182e855 (AT) l28g2000prd (DOT) googlegroups.com...
Quote:
Hi,

Is it possible to return all rows from a query on one line?

I have this query:

SELECT cnt || ':' || t_id
FROM (SELECT COUNT(*) cnt, t_id
FROM zc_body zb, zc_type zt
WHERE zb.t_id = zt.id
group by t_id);

It returns data like this:

86:3
994:7
99:18
38:27
45:36

However, they want it in one line: 86:3,994:7,99:18,38:27,45:36

Can this be done?

Thanks!

John

Give 'them' a text editor.

Shakespeare




Reply With Quote
  #3  
Old   
Shakespeare
 
Posts: n/a

Default Re: Query Question - 06-19-2008 , 01:10 PM




"Mtek" <mtek (AT) mtekusa (DOT) com> schreef in bericht
news:c80264dd-be17-4754-a00e-483b4182e855 (AT) l28g2000prd (DOT) googlegroups.com...
Quote:
Hi,

Is it possible to return all rows from a query on one line?

I have this query:

SELECT cnt || ':' || t_id
FROM (SELECT COUNT(*) cnt, t_id
FROM zc_body zb, zc_type zt
WHERE zb.t_id = zt.id
group by t_id);

It returns data like this:

86:3
994:7
99:18
38:27
45:36

However, they want it in one line: 86:3,994:7,99:18,38:27,45:36

Can this be done?

Thanks!

John

Give 'them' a text editor.

Shakespeare




Reply With Quote
  #4  
Old   
Shakespeare
 
Posts: n/a

Default Re: Query Question - 06-19-2008 , 01:10 PM




"Mtek" <mtek (AT) mtekusa (DOT) com> schreef in bericht
news:c80264dd-be17-4754-a00e-483b4182e855 (AT) l28g2000prd (DOT) googlegroups.com...
Quote:
Hi,

Is it possible to return all rows from a query on one line?

I have this query:

SELECT cnt || ':' || t_id
FROM (SELECT COUNT(*) cnt, t_id
FROM zc_body zb, zc_type zt
WHERE zb.t_id = zt.id
group by t_id);

It returns data like this:

86:3
994:7
99:18
38:27
45:36

However, they want it in one line: 86:3,994:7,99:18,38:27,45:36

Can this be done?

Thanks!

John

Give 'them' a text editor.

Shakespeare




Reply With Quote
  #5  
Old   
Shakespeare
 
Posts: n/a

Default Re: Query Question - 06-19-2008 , 01:10 PM




"Mtek" <mtek (AT) mtekusa (DOT) com> schreef in bericht
news:c80264dd-be17-4754-a00e-483b4182e855 (AT) l28g2000prd (DOT) googlegroups.com...
Quote:
Hi,

Is it possible to return all rows from a query on one line?

I have this query:

SELECT cnt || ':' || t_id
FROM (SELECT COUNT(*) cnt, t_id
FROM zc_body zb, zc_type zt
WHERE zb.t_id = zt.id
group by t_id);

It returns data like this:

86:3
994:7
99:18
38:27
45:36

However, they want it in one line: 86:3,994:7,99:18,38:27,45:36

Can this be done?

Thanks!

John

Give 'them' a text editor.

Shakespeare




Reply With Quote
  #6  
Old   
Shakespeare
 
Posts: n/a

Default Re: Query Question - 06-19-2008 , 01:10 PM




"Mtek" <mtek (AT) mtekusa (DOT) com> schreef in bericht
news:c80264dd-be17-4754-a00e-483b4182e855 (AT) l28g2000prd (DOT) googlegroups.com...
Quote:
Hi,

Is it possible to return all rows from a query on one line?

I have this query:

SELECT cnt || ':' || t_id
FROM (SELECT COUNT(*) cnt, t_id
FROM zc_body zb, zc_type zt
WHERE zb.t_id = zt.id
group by t_id);

It returns data like this:

86:3
994:7
99:18
38:27
45:36

However, they want it in one line: 86:3,994:7,99:18,38:27,45:36

Can this be done?

Thanks!

John

Give 'them' a text editor.

Shakespeare




Reply With Quote
  #7  
Old   
Shakespeare
 
Posts: n/a

Default Re: Query Question - 06-19-2008 , 01:10 PM




"Mtek" <mtek (AT) mtekusa (DOT) com> schreef in bericht
news:c80264dd-be17-4754-a00e-483b4182e855 (AT) l28g2000prd (DOT) googlegroups.com...
Quote:
Hi,

Is it possible to return all rows from a query on one line?

I have this query:

SELECT cnt || ':' || t_id
FROM (SELECT COUNT(*) cnt, t_id
FROM zc_body zb, zc_type zt
WHERE zb.t_id = zt.id
group by t_id);

It returns data like this:

86:3
994:7
99:18
38:27
45:36

However, they want it in one line: 86:3,994:7,99:18,38:27,45:36

Can this be done?

Thanks!

John

Give 'them' a text editor.

Shakespeare




Reply With Quote
  #8  
Old   
Shakespeare
 
Posts: n/a

Default Re: Query Question - 06-19-2008 , 01:10 PM




"Mtek" <mtek (AT) mtekusa (DOT) com> schreef in bericht
news:c80264dd-be17-4754-a00e-483b4182e855 (AT) l28g2000prd (DOT) googlegroups.com...
Quote:
Hi,

Is it possible to return all rows from a query on one line?

I have this query:

SELECT cnt || ':' || t_id
FROM (SELECT COUNT(*) cnt, t_id
FROM zc_body zb, zc_type zt
WHERE zb.t_id = zt.id
group by t_id);

It returns data like this:

86:3
994:7
99:18
38:27
45:36

However, they want it in one line: 86:3,994:7,99:18,38:27,45:36

Can this be done?

Thanks!

John

Give 'them' a text editor.

Shakespeare




Reply With Quote
  #9  
Old   
Maxim Demenko
 
Posts: n/a

Default Re: Query Question - 06-19-2008 , 01:21 PM



Mtek schrieb:
Quote:
Hi,

Is it possible to return all rows from a query on one line?

I have this query:

SELECT cnt || ':' || t_id
FROM (SELECT COUNT(*) cnt, t_id
FROM zc_body zb, zc_type zt
WHERE zb.t_id = zt.id
group by t_id);

It returns data like this:

86:3
994:7
99:18
38:27
45:36

However, they want it in one line: 86:3,994:7,99:18,38:27,45:36

Can this be done?

Thanks!

John

SQL> with t as (
2 select '86:3' cnt_t_id from dual union all
3 select '994:7' from dual union all
4 select '99:18' from dual union all
5 select '38:27' from dual union all
6 select '45:36' from dual
7 )
8 -- End test data
9 select wm_concat(cnt_t_id)
10 from t
11 ;

WM_CONCAT(CNT_T_ID)
--------------------------------------------------
86:3,994:7,99:18,38:27,45:36


or search on asktom for "stragg"

Best regards

Maxim


Reply With Quote
  #10  
Old   
Maxim Demenko
 
Posts: n/a

Default Re: Query Question - 06-19-2008 , 01:21 PM



Mtek schrieb:
Quote:
Hi,

Is it possible to return all rows from a query on one line?

I have this query:

SELECT cnt || ':' || t_id
FROM (SELECT COUNT(*) cnt, t_id
FROM zc_body zb, zc_type zt
WHERE zb.t_id = zt.id
group by t_id);

It returns data like this:

86:3
994:7
99:18
38:27
45:36

However, they want it in one line: 86:3,994:7,99:18,38:27,45:36

Can this be done?

Thanks!

John

SQL> with t as (
2 select '86:3' cnt_t_id from dual union all
3 select '994:7' from dual union all
4 select '99:18' from dual union all
5 select '38:27' from dual union all
6 select '45:36' from dual
7 )
8 -- End test data
9 select wm_concat(cnt_t_id)
10 from t
11 ;

WM_CONCAT(CNT_T_ID)
--------------------------------------------------
86:3,994:7,99:18,38:27,45:36


or search on asktom for "stragg"

Best regards

Maxim


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.