PERSONALL Please
I have a SQL query that is returning me 2 lines, that is, 2 description.
I need this query to return to the invors of 2 rows, only 1.
Example:
Select name from product WHERE FAMILIAS PRODUCT = 'FAMILY'
Result is =
Product01
Product02
But I need to return
Product01 / Product02
How do I do this?
Thanks
Return on just one line
-
- Moderador
- Posts: 1177
- Joined: Thu, 15 Oct 2009 10:28 am
- Location: Recife
There are several topics in the forum, search for
result lines in spine, something like this,
result lines in spine, something like this,
This searches for Crosstab http://en.glufke.net/oracle/viewtopic.php?t=1651
-
- Rank: Estagiário Sênior
- Posts: 11
- Joined: Tue, 09 Jun 2009 10:46 am
- Location: salvador - bahia
I believe that a consulted type below resolves:
select produto1 || produto2
from tabela
-
- Rank: Estagiário Sênior
- Posts: 13
- Joined: Mon, 20 Jun 2011 2:14 pm
- Location: Campinas - SP
Dude, I believe that with Select will be complicated, you can make a function with a cursor that mount the string the way you want. Example:
create or replace function conc_resultado(scondicao in varchar) return varchar2 is
Result varchar2(32000);
cursor c is
select familia from produtos where familia = scondicao;
begin
for r in c loop
result := result ||'/'|| r.familia;
end loop;
return(Result);
end conc_resultado;
I agree with miffs.
In summary you are wanting to transform lines in columns. Right?
The problem is that lines grow to the extent that new records are inserted. Therefore, it needs to be something dynamic as the fifths presented.
Search right here in Forum: How to transform lines into columns.
Hugs
In summary you are wanting to transform lines in columns. Right?
The problem is that lines grow to the extent that new records are inserted. Therefore, it needs to be something dynamic as the fifths presented.
Search right here in Forum: How to transform lines into columns.
Hugs
-
- Rank: Analista Júnior
- Posts: 82
- Joined: Tue, 28 Dec 2010 7:41 pm
- Location: São Paulo - SP
att. Fabio Ishii
http://ishii.profissionaloracle.com.br
http://ishii.profissionaloracle.com.br
Hello,
Take a look at this link and see if it helps you ...
http://www.dba-oracle.com/t_converting_rows_columns.htm
: -O
Take a look at this link and see if it helps you ...
http://www.dba-oracle.com/t_converting_rows_columns.htm
: -O
If you are using Oracle 11g, use the Analytical Listagg function. See the link http://www.oracle-base.com/articles/mis ... niques.php.
in my Tuning BD SQL training in Oracle (10G and 11G) I teach how to use these functions. See http://www.fabioprado.net/p/treinamentos.html
Att,
Fábio Prado www.fabioprado.net
in my Tuning BD SQL training in Oracle (10G and 11G) I teach how to use these functions. See http://www.fabioprado.net/p/treinamentos.html
Att,
Fábio Prado www.fabioprado.net
-
- Information
-
Who is online
Users browsing this forum: No registered users and 14 guests