Getting data of two columns in one column
Hi,
I need to show data of two columns in one column, I also want to insert space between the data of both the columns in the output
can i use something like this ?
(IMPORTER_NAME+' '+IMPORTER_ADDRESS) as "Location"
872435 wrote:
Hi,
I need to show data of two columns in one column, I also want to insert space between the data of both the columns in the output
can i use something like this ?
(IMPORTER_NAME+' '+IMPORTER_ADDRESS) as "Location"You can either use the CONCAT function or || -
SQL> select 'Hello'||' '||'World', CONCAT(CONCAT('Hello',' '),'World') from dual;
'HELLO'||'' CONCAT(CONC
Hello World Hello WorldHTH
David
Similar Messages
-
Getting data of two records in one line using SQL
Hi,
We have a COMPANY_RESEARCH table that maps companies to the Research Universes that do research on them. This table has:
COMPANY_ID VARCHAR2(100), foreign key to COMPANY table.
RESEARCH_UNIT_ID CHAR(1)
Valid values for RESEARCH_UNIT_ID are 1(US Equity), 2(Canadian Equity) and 3(Debt security).
Within my COMPANY_RESEARCH_ID table, I have:
COMPANY_ID RESEARCH_UNIT_ID
aaaa 2
aaaa 3
How can I write a SQL query that gives me the output?
Company Id Equity Debt
aaaa Canada Yes
My attempt was as below:
select
FILTERED_COMPANIES.COMPANY_ID as Company,
DECODE(FILTERED_COMPANIES.RESEARCH_UNIT_ID,'1','US','2','Canada','3','N/A') As Equity,
DECODE(FILTERED_COMPANIES_1.RESEARCH_UNIT_ID,'1','N/A','2','N/A','3','Yes') as Debt
FROM
select distinct
company_id, research_unit_id
from company_research_relation
)FILTERED_COMPANIES,
select distinct
company_id, research_unit_id
from company_research_relation
)FILTERED_COMPANIES_1
WHERE
FILTERED_COMPANIES.COMPANY_ID = FILTERED_COMPANIES_1.COMPANY_ID
AND FILTERED_COMPANIES.RESEARCH_UNIT_ID = FILTERED_COMPANIES_1.RESEARCH_UNIT_ID
but that produces output as below:
Company Id Equity Debt
aaaa Canada N/A
aaaa N/A Yes
Thanks in advance..Hi,
how about this one?
SELECT select_equity.company_id, enquity, dept, select_equity.research_unit_id, SELECT_dept.research_unit_id
FROM
(SELECT company_id, research_unit_id, DECODE(RESEARCH_UNIT_ID,'1','US','2','Canada','3','N/A') enquity FROM company_research) select_equity,
(select company_id, research_unit_id, DECODE(RESEARCH_UNIT_ID,'1','N/A','2','N/A','3','Yes') Dept FROM company_research) SELECT_dept
WHERE select_equity.company_id = SELECT_dept.company_id
AND enquity != 'N/A'
AND dept != 'N/A';
Regards,
Gerd -
Spry insert master/detail layout Can't get more than two columns?
Ive been trying to get more than two columns just experimenting with spry data sets and can't with the layout option "insert master/detail layout"
What am I doing wrong?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="SpryAssets/SpryData.js" type="text/javascript"></script>
<script src="SpryAssets/SpryHTMLDataSet.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMasterDetail.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var ds1 = new Spry.Data.HTMLDataSet("benefitsdata.html", "bizben", {firstRowAsHeaders: false});
</script>
</head>
<body>
<div align="center">
<div class="MasterDetail">
<div spry:region="ds1" class="MasterContainer">
<div class="MasterColumn" spry:repeat="ds1" spry:setrow="ds1" spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">{column0}</div>
</div>
<div spry:detailregion="ds1" class="DetailContainer">
<div class="DetailColumn">{column1}</div>
<div class="DetailColumn">{column2}</div>
<div class="DetailColumn">{column3}</div>
</div>
<br style="clear:both" />
</div>
</div>
</body>
</html>Hello,
in addition to Sudarshan's statement about the discontinued support: In my SPRY library I found this "html_dataset_sample". Maybe it could help you. Here the source code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script src="SpryAssets/SpryData.js" type="text/javascript"></script>
<script src="SpryAssets/SpryHTMLDataSet.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
var ds1 = new Spry.Data.HTMLDataSet("benefitsdata.html", "bizben", {firstRowAsHeaders: false, useCache: false, tableModeEnabled: false, sortOnLoad: "column0", sortOrderOnLoad: "ascending", rowSelector: "tr.destroyed", dataSelector: "td"});
ds1.setColumnType("column2", "number");
ds1.setColumnType("column3", "number");
ds1.setColumnType("column4", "number");
//-->
</script>
</head>
<body>
<div spry:region="ds1">
<table>
<tr align="center" valign="middle">
<th width="100" spry:sort="column0">Name</th>
<th width="100" spry:sort="column1">Class</th>
<th width="100" spry:sort="column2">Length(m)</th>
<th width="100" spry:sort="column3">Crew Size</th>
<th width="100" spry:sort="column4">Crew 1</th>
</tr>
<tr align="center" valign="middle" spry:repeat="ds1">
<td width="100"><p>{column0.1}{column0.2}{column0.3}</td>
<td width="100">{column1}</td>
<td width="100">{column2}</td>
<td width="100">{column3}</td>
<td width="100">{column4}</td>
</tr>
</table>
</div>
</body>
</html>
Hans-Günter -
APEX CSS - How do I get data in report columns to wrap?
I found information here http://www.orafaq.com/wiki/APEX_FAQ
About How do I get data in report columns to wrap?
This works and another way to do it is by adding the CSS directly into the
Home>Application Builder>Application 137>Page 1>Report Attributes>Column Attributes page
in the Column Formatting area. I added 'white-space:normal' and this works in FF but in
IE it has a different behavior.
In FireFox
testasdgadhad
gadfadgadgadg
adgafhsrgjsgnsfg
nsdfbadfafhafha
dfhadfh
In Internet Explorer
testasdgadhad gadfadgadgadg adgafhsrgjsgnsfg nsdfbadfafhafha dfhadfh
Is there a way to force it so it display in IE the same way that it displays in FF?
The correct display format is FF.
Thanks,
Nestor :)I have try this because I found it during a search and it makes no difference in IE.
This is what I am using now 'display: block; width: 100px;max-width:100px;white-space:normal'
I also tried 'display:block; width:500px'
If I use the values 'normal' or 'pre' for white-space' it works in FireFox but not in IE, The display block
does not seem to make a difference. It seems that all I need is 'white-space:normal' but again
it does not works on IE.
Thanks,
Nestor :-) -
Get data from two databases?
Hello all,
Do anyone know if it's posible to get data from two databases while I'm running SBO in one of them? I need this because our client wants to be able to print reports with all the information stored in both companies. I searched this forum trying to find if this is possible but I did't find any information about this.
Can someone help me?
Thanks and regards,
Mariana MazzeroHi Mariana,
What you can do is use two company objects to retrieve the data. As far as I know you're not restricted to one company connection.
You can also just use a standard read only connection (like ADO/ODBC) to retrieve the data for the reports.
Hope it helps,
Adele -
We are trying to modify the “SaveToFile” example for C++. This particular example comes with NI-scope 2.9.1 and some other versions. This example collects data from one channel and saves the output as a text file. Also, we are using NI PCI-5112 DAQ.
However, it can be modified to get data from channel 0 and channel 1 at the same time. There is a help file called “Fetching Multiple-Record Acquisitions”, which is under the NI-High speed digitizer help topics. This confirms that you can modify the code to get data from two channels and the output will be a text file where every other value is from one channel. This help file also gives some code. However, it is not very much helpful to us, please keep in mind that we have only taken a basic course in C++.
Our project is to analyze the data, however, we need to acquire the data before we can analyze. We have spent so much time trying to get the data. What we need to do is get data from both channels simultaneously and output the data as a text file.
Can anyone help us to modify the code so it can get data from both channels simultaneously? Or can anyone help as where we can get more information? Or does anyone know of any sample examples that will take data from two channels simultaneously and output the data as a text file or any other type of document.
Any help will be really appreciated, as we have spent so much time trying to acquire the data.
Thanks.Hi Finomad,
Please see this post for an answer to your question.
Regards,
Natasa -
Get value of two fields into one field
Hellou,
i need little help with javascript again
Currently i'm using code below to get value from one field to other:
getField("Text35").value = getField("Text1").valueAsString;
Now i'm wondering how to change this code, so i could get values from two fields into one. For example i have field "firstname" and field "lastname", now i want to show this in field "name".
Example, if field firstname have value John and field lastname value is Doe, i want to show it in field name like "John Doe".
I hope that u understood what i want
Thanks for helping me!getField("Text35").value = getField("Text1").valueAsString + " " +
getField("Text2").valueAsString; -
Retrieve of data from two columns into one column
For eg: i have a data in a table with columns A & B of same size
A B
1 2
2
3 1
4 2
5 3
6 5
7 1
8 4
9
10 8
Through a select i want the output of my data in one single
columns, Well I can do this by using union.
But my output should be like
if I select by condition where A=2
my output should be
2
1
3
7
4
because all these numbers are linked with 2 how do i do this
because it is like searching the number 2 in two columns and wherever this number 2 is linked i should get all the data relevant to it.
Hope u got my point what i exactly want
Can anyone help me it is quite urgent.
Regards
Vamsi Mohani do not a concatenated data
i have a data in a table with columns A & B of same size
A B
1 2
2
3 1
4 2
5 3
6 5
7 1
8 4
9
10 8
if my where condition is 'where A=2'
my output should be
1
2
3
4
5
6
8
10
i want my query to search as loop so that it keeps on searching
for related data as in my case it is
2 is linked to 1
1 is linked to 3
3 is linked to 4
my query should keep on seaching for linked numbers till
it does not find any mathing linked numbers
and the resulted output should come in one single column -
Unexpected results getting data from two fact tables through conformed dim
Hi all,
We are getting an unexpected behaviour in our OBIEE 10.1.3.3.3. We have this scenario:
We have {color:#0000ff}2 fact tables{color}{color:#000000} called F1 and F2. F1 has one measure, f1m1 and F2 has another one, f2m1.
We have {color:#0000ff}4 conformed dimensions{color}, called D1, D2, D3, Date.
When we are requesting for individual fact tables, we are getting:
date d1 d2 d3 f1m1
dt1 - x - y - z - m1
dt1 - x - y - z' - m2
date d1 d2 d3 f2m1
dt1 - x - y - z - m3
dt1 - x - y - z'' - m4
But, trying to obtain a compare scenario, we are getting
date d1 d2 d3 f1m1 f2m1
dt1 x y z m1 m4
Instead of
date d1 d2 d3 f1m1 f2m1
dt1 x y z m1 m3
Looking at query log, we have catched the reason. That's why BI Server is using to solve this request using ROW_COUNT() to join SAWITH0 and SAWITH1 in SAWITH2 result set. So, the order may not be the same in the results sets in every fact table. More or less, generated query is like:
WITH
SAWITH0 AS
(select ....
from F1),
SAWITH1 AS
(select ...
from F2),
SAWITH2 AS
select from (select ...
ROW_NUMBER() OVER PARTITION (....) c10
from SAWITH0.d1 full outer join SAWITH1.d1 ....) D1
{color:#ff0000}where (D1.c10 = 1){color}
select SAWITH2. ....
from SAWITH2
order by c1..c10
The problems seems to be that BI server is ordering the result sets SAWITH0 and SAWITH1 and getting row number to join this results sets, but this is not getting the correct result.
Any ideas?
TIA
Javier
{color}
Edited by: jirazazábal on Mar 13, 2009 2:46 PMI have done a logical fact table with two fact table source on it.
The Sql performed against the database was this one.
-------------------- Sending query to database named PRODS_AIX (id: <<153418>>):
WITH
SAWITH0 AS (select sum(T21296.CONSUMERS_SALES_EURO) as c1,
T21309.DIVISION_CODE as c2
from
DIVISION T21309,
C_CONSUMERS_SALES T21296
where ( T21296.DIVISION = T21309.DIMENSION_KEY )
group by T21309.DIVISION_CODE),
SAWITH1 AS (select sum(T21356.ORDER_VALUE) as c1,
T21309.DIVISION_CODE as c2
from
DIVISION T21309,
DWH_SALES_ORDER_OVERVIEW T21356
where ( T21309.DIMENSION_KEY = T21356.DIVISION_KEY )
group by T21309.DIVISION_CODE)
select distinct case when SAWITH0.c2 is not null then SAWITH0.c2 when SAWITH1.c2 is not null then SAWITH1.c2 end as c1,
SAWITH0.c1 as c2,
SAWITH1.c1 as c3
from
SAWITH0 full outer join SAWITH1 On nvl(SAWITH0.c2 , 'q') = nvl(SAWITH1.c2 , 'q') and nvl(SAWITH0.c2 , 'z') = nvl(SAWITH1.c2 , 'z')
order by c1As you can see one select (SAWITH0) for the first fact table C_CONSUMERS_SALES and one select for the second fact table DWH_SALES_ORDER_OVERVIEW (SAWITH1 ) and the two statement are joined with a full outer join.
I ask me why you have the three select (SAWITH0,SAWITH1 and SAWITH2). Can you please paste the complete SQL performed ?
Can you tell us also which SQL is performed if you select only the columns from one fact table and not for the other ?
Regards
Nico
http://gerardnico.com -
I want to do a query that returns data only from last two partitions
I have this select that returns data from one partition only.
select *
from tsieven PARTITION(P200707_2Q)
I would like to have something like this for example...
select *
from tsieven PARTITION(P200707_2Q and P200707_1Q)Oracle version is 9i
Partition method (MAX VALUE): TO_DATE(' 2006-04-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
Usually the partition is divided by 15 days. starts in the begin of the month and ends in 15th of the same month.
Partition column: DATA_CRIACAO
I'm trying to to this query:
select tsieven.loptica, tsieven.data_evento Data_Distribuicao
from tsieven (PARTITION MAX), tgirnos n, tsiobje o
where tsieven.no_evento = n.COD_NO
and tsieven.loptica = o.loptica
and to_char(tsieven.data_evento,'dd-mm-yyyy') = to_char(p_data,'dd-mm-yyyy')
and o.cod_classe = p_classe
and n.COD_TIPO_NO='2'
and tsieven.COD_T_EVEN = 'EMZ'
and n.cod_no = p_cdp
order by tsieven.loptica
For example I need to get data for sysdate from 27th of july it's not in this last partition, because it started a new one in 1st of august.
Hope I'm being clear now.
Thanks for your help. -
How to combine data from two rows into one row
I have the following sets of data. I want to find all the duplicate sets of field values. in the data below there is only one duplicate set: brenda, analyst, green.
DocID and Doc Seq combine to form the set key. FieldID I believe are consistent in that 1 is always name, 2 is job, 3 is favorite color etc. but there are up to 20 field IDs.
To tell you the truth, my client is a bit sketchy about the data and the values. I would like collapse the sets by getting all the field values into a single row. They could be in the same column, or in their own columns. This way I can then look for whatever
dups my customer seems to think that he has.
the first image is what i want (either in same column or in different columns. but they have to be in the order of the FieldID), the second is what i have. THANKSCREATE TABLE #t (
c1 INT NOT NULL PRIMARY KEY,
c2 VARCHAR(50) NOT NULL
GO
INSERT INTO #t(c1, c2) VALUES(1, 'P1,P2,P3')
INSERT INTO #t(c1, c2) VALUES(2, 'P2,P3')
GO
-- Generate set of numbers
-- Idea from Itzik Ben-Gan
;WITH
L0 AS (SELECT 1 AS n UNION ALL SELECT 1),
L1 AS (SELECT 1 AS n FROM L0 AS a, L0 AS b),
L2 AS (SELECT 1 AS n FROM L1 AS a, L1 AS b),
L3 AS (SELECT 1 AS n FROM L2 AS a, L2 AS b),
L4 AS (SELECT 1 AS n FROM L3 AS a, L3 AS b),
Numbers AS (SELECT ROW_NUMBER() OVER(ORDER BY (SELECT 1)) AS Number FROM L4)
SELECT
t.c1,
t.c2,
SUBSTRING(',' + t.c2 + ',', Number + 1, CHARINDEX(',', ',' + t.c2 + ',',
Number + 1) - Number - 1) AS Item,
ROW_NUMBER() OVER(PARTITION BY t.c1 ORDER BY n.Number) AS rn
FROM
#t AS t, Numbers AS n
WHERE
n.Number <= LEN(t.c2)
AND SUBSTRING(',' + t.c2 + ',', n.Number, 1) = ','
ORDER BY
t.c1, rn
GO
DROP TABLE #t
GO
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Hi all, i am trying to solve an specific scenario which i am having trouble with. here is my data
WITH data AS
SELECT 123 id, '10.30.2009' dt, 10 src, 'test1' name, 145 yd, 780 pdf, 'hd1' var FROM dual UNION ALL
SELECT 123 id, '10.31.2009' dt, 10 src, 'test2' name, 146 yd, 781 pdf, 'hd2' var FROM DUAL UNION ALL
SELECT 123 id, '11.10.2009' dt, 10 src, 'test3' name, 147 yd, 782 pdf, 'hd3' var FROM DUAL UNION ALL
SELECT 123 id, '11.11.2009' dt, 10 src, 'test4' name, 147 yd, 182 pdf, 'hd4' var FROM DUAL UNION ALL
SELECT 123 id, '11.12.2009' dt, 10 src, 'test5' name, 167 yd, 212 pdf, 'hd33' var FROM DUAL UNION ALL
SELECT 123 id, '11.13.2009' dt, 10 src, 'test6' name, 137 yd, 322 pdf, 'hd34' var FROM DUAL UNION ALL
SELECT 123 id, '9.27.2009' dt, 10 src, 'test7' name, 148 yd, 783 pdf, 'hd4' var FROM DUAL UNION ALL
SELECT 123 id, '10.12.2009' dt, 10 src, 'test8' name, 149 yd, 784 pdf, 'hd5' var FROM DUAL
data2
SELECT 123 id, '9.25.2009' dt, 11 src, 'test4' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '9.26.2009' dt, 11 src, 'test5' name, 135 yd FROM DUAL UNION ALL
SELECT 123 id, '9.27.2009' dt, 11 src, 'test7' name, 15 yd FROM DUAL UNION ALL
SELECT 123 id, '9.28.2009' dt, 11 src, 'test8' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '9.29.2009' dt, 11 src, 'test99' name, 175 yd FROM DUAL UNION ALL
SELECT 123 id, '9.30.2009' dt, 11 src, 'test44' name, 175 yd FROM DUAL UNION ALL
SELECT 123 id, '9.31.2009' dt, 11 src, 'test33' name, 148 yd FROM DUAL UNION ALL
SELECT 123 id, '10.1.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.2.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.3.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.4.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.5.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.6.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.7.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.8.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.9.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.10.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.11.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.12.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.13.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.14.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.15.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.16.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.17.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.18.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.19.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.20.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.21.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.22.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.23.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.24.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.25.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.26.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.27.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.28.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.29.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.30.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.31.2009' dt, 11 src, 'test' name, 146 yd FROM DUAL UNION ALL
SELECT 123 id, '11.01.2009' dt, 11 src, 'test' name, 147 yd FROM DUAL UNION ALL
SELECT 123 id, '11.2.2009' dt, 11 src, 'test' name, 148 yd FROM DUAL UNION ALL
SELECT 123 id, '11.3.2009' dt, 11 src, 'test' name, 149 yd FROM DUAL UNION ALL
SELECT 123 id, '11.4.2009' dt, 11 src, 'test' name, 141 yd FROM DUAL UNION ALL
SELECT 123 id, '11.5.2009' dt, 11 src, 'test' name, 148 yd FROM DUAL UNION ALL
SELECT 123 id, '11.6.2009' dt, 11 src, 'test' name, 149 yd FROM DUAL UNION ALL
SELECT 123 id, '11.7.2009' dt, 11 src, 'test' name, 141 yd FROM DUAL UNION ALL
SELECT 123 id, '11.8.2009' dt, 11 src, 'test' name, 141 yd FROM DUAL UNION ALL
SELECT 123 id, '11.9.2009' dt, 11 src, 'test' name, 141 yd FROM DUAL UNION ALL
SELECT 123 id, '11.10.2009' dt, 11 src, 'test' name, 141 yd FROM DUAL
as you can see there are some rows in data table that matches the id, dt in data2.
there is some rows in data2 that is not there in data table and vice versa. also both tables columns
are identical except that data has more columns that data2 doesnt have. i want to write a query.
i would like to join data and data2 table.
if a row in data table matches a row in data2 then i would take the row in data table
and display it along with the rest of the columns. if a row is not found in data but it is found
in data2 for a particular id (in this case 123) then i want to display the row from data2 and the rest of the columns value from data2.
please note that in the data above i gave you one specific id 123. my tables will have the same situation as above
for different id. the output of the above query should be as follow.
ID DT SRC NAME YD PDF VAR
123 9.25.2009 11 testt 145
123 9.26.2009 11 test5 135
123 9.27.2009 10 test7 148 783 hd4
123 9.28.2009 11 test8 145
123 9.29.2009 11 test99 175
123 9.30.2009 11 test44 175
123 9.31.2009 11 test33 148
123 10.1.2009 11 test 145
123 10.2.2009 11 test 145
123 10.3.2009 11 test 145
123 10.4.2009 11 test 145
123 10.5.2009 11 test 145
123 10.6.2009 11 test 145
123 10.7.2009 11 test 145
123 10.8.2009 11 test 145
123 10.9.2009 11 test 145
123 10.10.2009 11 test 145
123 10.11.2009 11 test 145
123 10.12.2009 10 test8 149 784 hd5
123 10.13.2009 11 test 145
123 10.14.2009 11 test 145
123 10.15.2009 11 test 145
123 10.16.2009 11 test 145
123 10.17.2009 11 test 145
123 10.18.2009 11 test 145
123 10.19.2009 11 test 145
123 10.20.2009 11 test 145
123 10.21.2009 11 test 145
123 10.22.2009 11 test 145
123 10.23.2009 11 test 145
123 10.24.2009 11 test 145
123 10.25.2009 11 test 145
123 10.26.2009 11 test 145
123 10.27.2009 11 test 145
123 10.28.2009 11 test 145
123 10.29.2009 11 test 145
123 10.30.2009 10 test1 145 780 hd1
123 10.31.2009 10 test2 146 781 hd2
123 11.01.2009 11 test 147
123 11.2.2009 11 test 148
123 11.3.2009 11 test 149
123 11.4.2009 11 test 141
123 11.5.2009 11 test 148
123 11.6.2009 11 test 149
123 11.7.2009 11 test 141
123 11.8.2009 11 test 141
123 11.9.2009 11 test 141
123 11.10.2009 10 test3 747 782 hd3
123 11.11.2009 10 test4 147 182 hd4
123 11.12.2009 10 test5 167 212 hd33
123 11.13.2009 10 test6 137 322 hd34
123 11.14.2009 11 test 141
if you notice, i am displaying the data from data table when there is a match in data and data2 tables for a particular id, dt combination.
if there is data in data2 that is not in data then i pull those data from data2 and display. the same thing goes for data table. if there is data in data table
but it is not there in data2 then i display data from data table. when rows matches then i take the one from data table
i would like to write a query that give the above output. if anybody can help, i will appreciate.
thanksHi,
I'm sorry, misread it and didn't look wll at the outcome. This is better:
WITH data AS
SELECT 123 id, '10.30.2009' dt, 10 src, 'test1' name, 145 yd, 780 pdf, 'hd1' var FROM dual UNION ALL
SELECT 123 id, '10.31.2009' dt, 10 src, 'test2' name, 146 yd, 781 pdf, 'hd2' var FROM DUAL UNION ALL
SELECT 123 id, '11.10.2009' dt, 10 src, 'test3' name, 147 yd, 782 pdf, 'hd3' var FROM DUAL UNION ALL
SELECT 123 id, '11.11.2009' dt, 10 src, 'test4' name, 147 yd, 182 pdf, 'hd4' var FROM DUAL UNION ALL
SELECT 123 id, '11.12.2009' dt, 10 src, 'test5' name, 167 yd, 212 pdf, 'hd33' var FROM DUAL UNION ALL
SELECT 123 id, '11.13.2009' dt, 10 src, 'test6' name, 137 yd, 322 pdf, 'hd34' var FROM DUAL UNION ALL
SELECT 123 id, '9.27.2009' dt, 10 src, 'test7' name, 148 yd, 783 pdf, 'hd4' var FROM DUAL UNION ALL
SELECT 123 id, '10.12.2009' dt, 10 src, 'test8' name, 149 yd, 784 pdf, 'hd5' var FROM DUAL
data2 as
SELECT 123 id, '9.25.2009' dt, 11 src, 'test4' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '9.26.2009' dt, 11 src, 'test5' name, 135 yd FROM DUAL UNION ALL
SELECT 123 id, '9.27.2009' dt, 11 src, 'test7' name, 15 yd FROM DUAL UNION ALL
SELECT 123 id, '9.28.2009' dt, 11 src, 'test8' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '9.29.2009' dt, 11 src, 'test99' name, 175 yd FROM DUAL UNION ALL
SELECT 123 id, '9.30.2009' dt, 11 src, 'test44' name, 175 yd FROM DUAL UNION ALL
SELECT 123 id, '9.31.2009' dt, 11 src, 'test33' name, 148 yd FROM DUAL UNION ALL
SELECT 123 id, '10.1.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.2.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.3.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.4.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.5.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.6.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.7.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.8.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.9.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.10.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.11.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.12.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.13.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.14.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.15.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.16.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.17.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.18.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.19.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.20.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.21.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.22.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.23.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.24.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.25.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.26.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.27.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.28.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.29.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.30.2009' dt, 11 src, 'test' name, 145 yd FROM DUAL UNION ALL
SELECT 123 id, '10.31.2009' dt, 11 src, 'test' name, 146 yd FROM DUAL UNION ALL
SELECT 123 id, '11.01.2009' dt, 11 src, 'test' name, 147 yd FROM DUAL UNION ALL
SELECT 123 id, '11.2.2009' dt, 11 src, 'test' name, 148 yd FROM DUAL UNION ALL
SELECT 123 id, '11.3.2009' dt, 11 src, 'test' name, 149 yd FROM DUAL UNION ALL
SELECT 123 id, '11.4.2009' dt, 11 src, 'test' name, 141 yd FROM DUAL UNION ALL
SELECT 123 id, '11.5.2009' dt, 11 src, 'test' name, 148 yd FROM DUAL UNION ALL
SELECT 123 id, '11.6.2009' dt, 11 src, 'test' name, 149 yd FROM DUAL UNION ALL
SELECT 123 id, '11.7.2009' dt, 11 src, 'test' name, 141 yd FROM DUAL UNION ALL
SELECT 123 id, '11.8.2009' dt, 11 src, 'test' name, 141 yd FROM DUAL UNION ALL
SELECT 123 id, '11.9.2009' dt, 11 src, 'test' name, 141 yd FROM DUAL UNION ALL
SELECT 123 id, '11.10.2009' dt, 11 src, 'test' name, 141 yd FROM DUAL
select data2.id,data2.dt,nvl(data.src,data2.src) src, nvl(data.name,data2.name) name,nvl(data.yd,data2.yd) yd,data.pdf,data.var
from data2,data
where data2.id = data.id(+)
and data2.dt = data.dt(+)Herald ten Dam
Superconsult.nl -
Combine the data of two DSOs into one
Hello experts,
how to load the data of two DSOs into a single one using transformations and DTPs?
Example:
DSO A keyfields: X,Y,Z / attributes M,N,O
DSO B keyfields: X,Y,Z / attributes P,Q
DSO C keyfields: X,Y,Z / attributes M,N,O,P,Q (result should be a single data record!)
In the transformation between DSO A and C I map all keyfields and attributes M,N,O (no mapping for P and Q, meaning no transformation rule). For B to C mapping is all keyfields and attributes P, Q (no mapping for M,N,O, no transformation rule).
When I now load the data of DSO A and DSO B to DSO C I either see the attributes M,N,O or P,Q. This means that only the latest DTP is available and overwrites the attributes with blank values of the first DTP.
I have a solution using ABAP coding but according to the SAP Training courses (BW330) it should work without using ABAP coding.
Any help is highly appreciated.
Thanks in advance.
MarcoHi Marco,
Thanks again
I looked into BW330 Business information warehouse - Modelling.
Course version : 2006 Q2
Material number : 50079531
I looked into the page 281 still no luck.
just an overview i need to create X,Y,Z,M,N,O as info objects characteristics
and P, O as infoobjects keyfigure.
None of them will have attributes and i load XYZMNO to DSO1 and same XYZPO to DSO2.
Then map DSO1 - DSO3 and DSO2 - DSO3 and carry out the steps to get the data from DSO1 and DSO2 to DSO3.
Am i right.
Regards,
Harish -
Issue in workflow workitem that gets triggered to two users at one time.
Hi All,
Below are the query details:
Module: HR
Area: Workflow
Process: Hiring
There is an workflow in HR module that is triggered when an hiring action is run against an candidate.
There are two or three maximum approvers which is based on the position to which the candidate is hired.
Issue:
During the hiring process some times the workitem is getting triggered to two users at once.
One is the actual approver who should receive the workitem in his UWL and other is the user of our service center who is no where involved in the approval process.
Analysis Done:
We checked the workflow log and found that the actual approver's ID is getting displayed under agent and workflow is complete. But the other user's ID is no where shown in the log but he has received an workitem in his UWL that makes the issue still confusing.
Awaiting for experts suggestions.Reply to Susan Questions:
You say that 'the workitem is getting triggered to two users at once' - do you mean that there are two workflow instances that are being kicked off at the same time when the hiring action is performed? Or is it that the workflow is generating two tasks that go to these different users?
Ans : There is a single task attached to the activity.
Is this a custom workflow?
Ans : Yes.
Are you certain that the erroneous task is only going to the user in the service center, or is it perhaps going to everybody (marked as a general task)?
Ans : The task is marked as general but the workitem is received by only one user of the service center at a time.
As this issue has taken place 4 times in the past year all the 4 receiver were different belonging to different position.
Reply to Pavan Questions:
1. Did you try to check the SPRO settings with respect to Hiring Process ,is there any where based on the position does workflow is forwarding the workitem to the other user.
2. Check the other user Roles and in the Org Structure where he is located , there could be a possibility of wrong position holding.
Ans : We checked the org structure, but org structure of both the centers are different and independent there is no linkage between the two.
*3. IF you are using custom workflow then check if any standard workflow is also getting triggered. Check *
Ans : Yes this is a custom workflow, but no other Standard workflow is being called.
4. Check in the SWEHR3 is any custom entries maintained.
Ans : No, entries are maintained in SWEHR3.
Additional Info :
The task that triggers the workitem has an send mail step before it.
The send mail activity is to notify receiver that there is an workitem lying in the UWL.This mail is received by the actual user and not by the other one.The next step is the task that creates workitem which gets triggered totwo different IDs.
This scenarios mostly has come up when the number of approver is 1. If the approver is more than 1 the workflow runs fine without deviating the workitem to any worng user. -
Different ways to copy data between two schemas in one instance
Hi there,
I am searching a good way to copy data between two schemas in the same instance.
Both schemas have an identical structure such as triggers, tables, views and so on. The only difference is the purpose: one is the productivity system and one is for development.
I looked at datapump but I do not explicit want to export / import. I want to keep the data in the productivity schema as well as copy it to the other schema. Any ideas? I found out there is a copy statement but I dont't know how that works.
Thank you so far,
JörnThank you for your replies!
I also thought of creating a second instance for development and move the dev - schema to it. I just don't know whether our server can handle both (performance?). Anyway the idea is to have a possibility to quickly rebuild the data inside a schema without indixes or triggers, just pure data. I thought the easiest way would be to copy the data between the schemas as they are exactly the same. However if you tell me DataPunp is the best solution i won't deny using it :).
When you export data a file is created. does that also mean that the exported data is deleted inside the schema?
best regards
Jörn
Ps: Guido, you are following me, aren' t you? ;-)
Maybe you are looking for
-
Server 2003 R2 DC migration to 2008 R2 worked? but exchange 2007 has stopped
Hi everyone, This is a single DC running on Server 2003 R2 which I migrated to a fresh install of Server 2008 R2. This appears to have worked without issue. DNS is working dcdiag and netdiag didn't report problems. When I demote the 2003 server howev
-
How to capture frames in Premier Pro to edit in Photoshop with correct aspect ratio.
I am using Premier Pro and Photoshop CS5 in Creative Studio CS5. I have read and understand several help articles on square and rectangular pixels used for various video aspect ratios. I am using the camera button on the bottom right of the Program
-
Monitor CPU and send output to file
Hello I want to monitor my CPU usage and my idea was this: 1. Use Top (/usr/bin/top –n 1|head –n 3| tail –n 1|awk '{print $2}') 2. Send output to file 3. crontab it My problem is now that my top command (see above) works fine in terminal, it will giv
-
WSRP or JSR-168 Portlets with PDK-Java
Is it possible to create WSRP or JSR-168 compliant portlets with PDK-Java or Bi beans? Thanks,
-
IMessage claims my apple ID/password is incorrect?
I am abroad and using a strong wifi connection whilst my iPhone 5 remains on airplane mode. iMessage has been working fine for up to 2 days. Until I am asked to confirm my apple ID and password which I do. It tells me that these details are incorrect