CustomSQL - DB Adapter - One Row
I'm inserting this statemend:
select STATUS from CREDITCARDINFO where CCNUMBER = #ccnumber
The xsd created (as follows) consider a collection as the result, but, only one row will be retrieved, what can do to solve that problem?
<?xml version = '1.0' encoding = 'UTF-8'?>
<xs:schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/DBA" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/DBA" elementFormDefault="qualified" attributeFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="DBAInput" type="DBAInput"/>
<xs:complexType name="DBAInput">
<xs:sequence>
<xs:element name="ccnumber" type="xs:string" nillable="true"/>
</xs:sequence>
</xs:complexType>
<xs:element name="DBAOutputCollection" type="DBAOutputCollection"/>
<xs:complexType name="DBAOutputCollection">
<xs:sequence>
<xs:element name="DBAOutput" type="DBAOutput" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DBAOutput">
<xs:sequence>
<xs:element name="STATUS" type="xs:string" nillable="true"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
This query will always give a single row as you are putting CCNumber=#ccnumber.
So you are passing a pareameter credit card number,which might be a primary key and for single ccnumber there will be single row.
Similar Messages
-
Selecting only one row at a time
Hi experts,
i have following doubt regarding selecting rows from a db:
Is there any way of selecting only one row AT A TIME from a dabase just to collect the data in rows instead of in a unique document containing all the rows?
I would like you to ellaborate on this as i need to send only one row to the IE, and then other row, and so on... without throwing any error!
I have seen that there are SELECT SINGLE and SELECT UP TO 1 ROW, but these two methods are only useful when retrieving only one row, and that does not match my requirements. I need to process all the rows but one by one..
I know that we can use the receiver jdbc adapter as if it was a sender by means of its specific datatype, but how to do it row by row??
Hope i had explained well..
Thanks in advance and best regards,
DavidHi kiran,
Yes, my table has 5 not null fields but i am selecting and updating fixes values so i think that I will definetely go for the next solution:
SELECT * FROM t1 WHERE status='0' and ROWNUM<2;
UPDATE t1 SET status='1' WHERE status='0' and ROWNUM<2;
My only concern is if the update will take the same row that the select.... BTW, I think it will
..What do you guys think?
I ve been trying to operate with your proposed queries but i received some errors. Your queries are very interesting but i think that with the above ones i meet my requirements as the status field will be 0 for not processed rows and 1 for precessed ones (and the update will look for the row that meets the same 'where' clause than the select, and then, and only then, it will set status='1').
The only thing i have to care about is what i questioned before.
Thanks a lot and best regards,
David -
How to insert more than one row in an Oracle table in one go
Hi All,
I am working on a file-XI(BPM)-Oracle scenario.
I am sending an xml file to XI via a file adapter. On the receiver end i am using a jdbc adapter to insert the row in the database. There is a transformation step within the BPM which is converting the file to a format understood by the JDBC adapter.
The problem i am facing is that, even if my input xml file contains more than one recordset, only one row is created in the database with the first recordset.
How can i insert all the other recordsets in the database at the same time.
Pls guide
Thanks in advance.
Regards
NeetuHi,
As asked by Bhavesh, i set the occurence of the STATEMENT tab 1 to UB. But still only one row is getting updated in the database at a time.
As asked by Udo, i even tried the same by changing the occrence of ACCESS tab 1 to UB. But still same thing happened.
Can there be some other problem.
The transformation is being dane in the BPM.
As seen in SXMB_MONI, the input xml to the BPM has two RECORDSET tags but the output generated xml in the format understood by jdbc adapter has a single STATEMENT tag.
The two formats are given below
<b>Input:</b>
<?xml version="1.0" encoding="utf-8"?>
<ns:MT_Test_File xmlns:ns="http://namespace-EmpNumberGen">
<EmpGenRecord>
<APPLICANT_NO>20</APPLICANT_NO>
<FIRST_NAME>abc</FIRST_NAME>
<LAST_NAME>xyz</LAST_NAME>
<FUNCTION>ADMIN</FUNCTION>
<DESIGNATION>ZA</DESIGNATION>
<RESPONSIBILITY_LEVEL>dd</RESPONSIBILITY_LEVEL>
<RECRUITMENT_TYPE>dd</RECRUITMENT_TYPE>
<EMPLOYEE_TYPE>p</EMPLOYEE_TYPE>
<STATUS>A</STATUS>
<***>M</***>
</EmpGenRecord>
<EmpGenRecord>
<APPLICANT_NO>14</APPLICANT_NO>
<FIRST_NAME>abc</FIRST_NAME>
<LAST_NAME>xyz</LAST_NAME>
<FUNCTION>ADMIN</FUNCTION>
<DESIGNATION>ZA</DESIGNATION>
<RESPONSIBILITY_LEVEL>dd</RESPONSIBILITY_LEVEL>
<RECRUITMENT_TYPE>dd</RECRUITMENT_TYPE>
<EMPLOYEE_TYPE>p</EMPLOYEE_TYPE>
<STATUS>A</STATUS>
<***>M</***>
</EmpGenRecord>
</ns:MT_Test_File>
<b>Output</b>
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Emp_No_Generation xmlns:ns0="http://namespace-EmpNumberGen">
<Statement>
<SAP_EMPGEN action="INSERT">
<access>
<APPLICANT_NO>20</APPLICANT_NO>
<FIRST_NAME>abc</FIRST_NAME>
<LAST_NAME>xyz</LAST_NAME>
<FUNCTION>ADMIN</FUNCTION>
<DESIGNATION>ZA</DESIGNATION>
<RESPONSIBILITY_LEVEL>dd</RESPONSIBILITY_LEVEL>
<RECRUITMENT_TYPE>dd</RECRUITMENT_TYPE>
<EMPLOYEE_TYPE>p</EMPLOYEE_TYPE>
<STATUS>A</STATUS>
<***>M</***>
</access>
</SAP_EMPGEN>
</Statement>
</ns0:MT_Emp_No_Generation>
This is a bit urgent.
Pls help
Regards
Neetu -
Dear all,
I have a input that looks like this:
HeaderKeySomeHeaderInformationItemKeySomeItemInformationItemKeySomeItemInformation...
Here's the actual input
TEHGMESS0026000000288S0001TEI2____026200006112410400000000 18010000000000 00126000000000126000120600000000002000000000 000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000JTEI2____026200006112410400000000 19010000000000 00126000000000126000120600000000002000000000 000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000J
HeaderKey = TEHGMESS
ItemKey = TEI2____
Is it possible to process this via MessageTransformBean (my actual scenario is JMS to IDoc)? I already tried but I only succeeded when having new lines in my input to separate between Header and (multiple) Items.
So when the input and my configuration looks like below it works, but when I only have a single row input it doesn't work, even when specifying xml.recordHeader.endSeparator = '0' / xml.recordItem.endSeparator = '0'. I even tried xml.endSeparator = '0' but no luck.
Input that works
TEHGMESS0026000000288S0001
TEI2____026200006112410400000000 18010000000000 00126000000000126000120600000000002000000000 000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000J
TEI2____026200006112410400000000 19010000000000 00126000000000126000120600000000002000000000 000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000J
Matching configuration that works for input which structures are delimited by new line.
Paramentername
Parametervalue
Transform.Class
com.sap.aii.messaging.adapter.Conversion
Transform.ContentType
text/xml;charset=utf-8
xml.conversionType
StructPlain2XML
xml.documentName
MT_TEI2Split
xml.documentNamespace
http://hansgrohe.com/pi/MQ/TEI2/10
xml.keyFieldName
SATZARTKey
xml.keyFieldType
CaseSensitiveString
xml.processFieldNames
fromConfiguration
xml.recordHeader.fieldFixedLengths
8,4,9,1,4
xml.recordHeader.fieldNames
SATZARTKey,SATZLENHG,NUTZLEN,MESSAE,MESSNR
xml.recordHeader.keyFieldValue
TEHGMESS
xml.recordItem.fieldFixedLengths
8,4,2,10,8,19,3,3,2,10,6,2,10,6,2,10,6,6,6,6,6,11,9,2,10,6,2,10,6,3,4,3,7,14,8,1,31
xml.recordItem.fieldNames
SATZARTKey,SATZLEN,BUCHART,TRNR,ANDGNR,MITEM,TEIVARI,BSTSTATU,REFTYP,ORNO,POS,REFTYP1,ORNO1,POS1,CHATYP,CHARGE,CHAPOS,ABBVONL,ABBNACH,ZUBVONL,ZUBNACH,I2MENG,I2BUNR,REFTYPN,ORNON,POSN,REFTYP1N,ORNO1N,POS1N,BSTSTATN,ABUSERAB,ABUSERFN,ABUSERNA,I2TIME,I2LIDNR,I2FMCODE,FILLER
xml.recordItem.keyFieldValue
TEI2____
xml.recordsetName
records
xml.recordsetStructure
recordHeader,1,recordItem,*
Any clues on this? Is it even possible to have multiple structures in one row? Many thanks in advance
JensSAP came back to me with this answer:
First, I would like to point the documentation for Message Transform
Bean (MTB) in 7.4:
http://help.sap.com/saphelp_nw74/helpdata/en/57/0b2c4142aef623e10000000a155106/content.htm?frameset=/en/57/0b2c4142aef623e10000000a155106/frameset.htm¤t_toc=/en/45/0ea2de423c2d6be10000000a11466f/plain.htm&node_id=18
As it is written at the beginning of this document, MTB is used to
call classes written for the Plain Adapter Engine. So you may find
additional documentation about the parameters for convertion in the
documentation of the Plain Adapter Engine
(http://help.sap.com/saphelp_nw74/helpdata/en/0d/00453c91f37151e10000000a11402f/content.htm?frameset=/en/1b/d5ef3b1ad56d4fe10000000a114084/frameset.htm¤t_toc=/en/75/246b3de666930fe10000000a114084/plain.htm&node_id=11).There it is written that the structures by default are
arranged line-by-line. The endSeparator just adds additional character
string as a separator after the last column in a row.
I hope that this answers your question. MTB expects the data to be
structured line by line.
You may add a custom module, which transforms the message in the
expected format.
If you have a look at the second link there's even a more precise wording that multiple structures within one line are not supported:
xml.NameA.endSeparator
Even if no specification is made here, a line break must follow since substructures are always expected as a line of the document.
Bottom line is that it's not supported by now and verfied by me with PI 7.4 SP5
Many thanks to Ambrish, Amit and Hareesh for the valuable input. Will probably try to work things out for now following Ambrish's / Hareesh's suggestion as this seems easier to implement. Amit's proposal with a dedicated module however would probably be the more polished solution.
Cheers
Jens -
How to return one ROW with Multiple value seperated by Colon in a SQL Query
Hi,
I have a SQL query as mentioned.
select deptno
from deptI want to mofidfy this query, so that this should return me department list with colon delimeted in one ROW.
10:20:30:40.......Thanks,
DeepakIn 10g:
select rtrim(xmlagg(xmlparse(content deptno || ':')).getstringval(), ':') data
from dept;
DATA
10:20:30:40with apologies for the abuse of XML... -
How to Plot number and string in one row (data logger counter via MODBUS) ?
hi all i made data log quantity using Digital Counter via modbus (RS-485) to monitoring quantity and reject that has and Name Operator, Machine and Part Number.
i have problem about plot the number & string in one row, as shown on the picture below :
how to move that string on one row ? i attach my vi.
Thanks~
Solved!
Go to Solution.
Attachments:
MODBUS LIB Counter.vi 39 KBHi rhiesnand,
right now you add 2 new rows to your array.
The solution is to concatenate both row parts to one bigger 1D array before adding that array as new row to your 2D array!
Like this:
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
How to Plot number and string in one row (data logger counter) ?
hi all i made data log quantity using Digital Counter via modbus to monitoring quantity and reject that has and Name Operator, Machine and Part Number.
i have problem about plot the number & string in one row, as shown on the picture below :
how to move that string on one row ? i attach my vi.
Thanks~
Attachments:
MODBUS LIB Counter.vi 39 KBDuplicate and answered - http://forums.ni.com/t5/LabVIEW/How-to-Plot-number-and-string-in-one-row-data-logger-counter-via/m-p...
-
Hi guys, I got a black out. I got this situation:
Create table Forum ( Icity varchar(50), IMonth int, Iyear int, ACons int, BCons int, CCons int) insert into forum values ('Buenos Aires',1,2014,100,0,0), ('Buenos Aires',2,2014,140,0,0), ('Buenos Aires',3,2014,60,0,0), ('Toronto',1,2014,400,0,0), ('Toronto',2,2014,625,0,0), ('Toronto',3,2014,880,0,0), ('Buenos Aires',1,2014,0,330,0), ('Buenos Aires',2,2014,0,1230,0), ('Buenos Aires',3,2014,0,470,0), ('Toronto',1,2014,0,1100,0), ('Toronto',2,2014,0,1520,0), ('Toronto',3,2014,0,400,0), ('Buenos Aires',1,2014,0,0,300),('Buenos Aires',2,2014,0,0,440), ('Buenos Aires',3,2014,0,0,1080), ('Toronto',1,2014,0,0,640), ('Toronto',2,2014,0,0,1020), ('Toronto',3,2014,0,0,880)
I had to run a huge union all taking data fro ACons, BCons, CCons, no way to do link or other stuff, we're talking about millions rows, different servers..anyway. I got this situation. Now I need an output like:
Buenos Aires 1 2014 100 330 300
Toronto 1 2014 400 1100 640
Pratically Icity, Imonth, Iyear, Acons, Bcons, Ccons in one rows and not in three difefrent rows. I already did this stuff a lot of time but I'm going underpressure by another side ( a Cube that doesn't update correctly).
Any suggestion? Thanks everyone.Are you looking for the below? If not, please let us know:
Create table Forum ( Icity varchar(50), IMonth int, Iyear int, ACons int, BCons int, CCons int)
insert into forum values
('Buenos Aires',1,2014,100,0,0), ('Buenos Aires',2,2014,140,0,0),
('Buenos Aires',3,2014,60,0,0), ('Toronto',1,2014,400,0,0),
('Toronto',2,2014,625,0,0), ('Toronto',3,2014,880,0,0),
('Buenos Aires',1,2014,0,330,0), ('Buenos Aires',2,2014,0,1230,0),
('Buenos Aires',3,2014,0,470,0), ('Toronto',1,2014,0,1100,0),
('Toronto',2,2014,0,1520,0), ('Toronto',3,2014,0,400,0),
('Buenos Aires',1,2014,0,0,300),('Buenos Aires',2,2014,0,0,440),
('Buenos Aires',3,2014,0,0,1080), ('Toronto',1,2014,0,0,640),
('Toronto',2,2014,0,0,1020), ('Toronto',3,2014,0,0,880)
Select Icity,IMonth,Iyear,MAX(ACons),MAX(BCons),MAX(cCons) From Forum
Group by Icity,IMonth,Iyear
Drop table Forum -
Multiple record in one row..
Hi experts,
I want to merge multiple row from same table into one row... is it possible? if so then how??
Regards,
SKPSure, it's possible
create table scott.a
as
select 1 a, 2 b from dual
union all
select 3 a, 4 b from dual
create table scott.b
(a number, b number, c number, d number)
insert into scott.b
select a1.a,a1.b,a2.a,a2.b from scott.a a1, scott.a a2
where a1.a = 1 and a2.a = 3
P.S. Sorry, at first misunderstood the task
Message was edited by:
Dmytro Dekhtyaryuk -
Query below is returning data in multiple rows, I want to display them as one row:
select
event_id,
data_type_cd,
quantity
from Event,Data_types
where event_id = 1234
and event.DATA_TYPE_ID = data_types.DATA_TYPE_ID
(I want to display data_type_cd concatenated with quantity as every code had different quantity)> Sample data is:
> Data_type_id Quantity
> ------------------ ----------
> 1 34
> 2 67
> 15 35
> 20 23
> I want to display as:
> 1 34 2 67 15 35 20 23
if you want all the rows in one column see this given example below:
SQL> select t.*
2 from (select 1 data_type_id, 34 quantity from dual union all
3 select 2 data_type_id, 67 quantity from dual union all
4 select 15 data_type_id, 35 quantity from dual union all
5 select 20 data_type_id, 23 quantity from dual) t;
DATA_TYPE_ID QUANTITY
1 34
2 67
15 35
20 23
SQL> select substr(sys_xmlagg(xmlelement(col, ' ' || data_type_id||' '||quantity)).extract('/ROWSET/COL/text()').getclobval(), 2) new_disp
2 from (select 1 data_type_id, 34 quantity from dual union all
3 select 2 data_type_id, 67 quantity from dual union all
4 select 15 data_type_id, 35 quantity from dual union all
5 select 20 data_type_id, 23 quantity from dual) t;
NEW_DISP
1 34 2 67 15 35 20 23
SQL> -
Concatenating values in one row
I need to write a function that will give me a concatenated list of all the records where gurmail_matl_code_mod like '8%'
This query is giving me those results:
GURMAIL_PIDM CODE1 CODE2
1135711
1135711 8IBD
1135711 8IBW
I want something like this 1135711 8IBW 8IBD in one row.
select
gurmail_pidm,
max(decode(rn,1,gurmail_matl_code_mod )) code1,
max(decode(rn,2,gurmail_matl_code_mod )) code2
from (select gurmail_pidm,
gurmail_matl_code_mod,
row_number() over (partition by gurmail_pidm order by gurmail_matl_code_mod desc) rn
from
(select gurmail_pidm,gurmail_matl_code_mod
from saturn.spriden,
general.gurmail
where spriden_pidm = gurmail_pidm
and spriden_change_ind is null
and gurmail_matl_code_mod like '8%'
and gurmail_pidm = 1135711
and GURMAIL_DATE_PRINTED is null
and gurmail_matl_code_mod is not null))
group by gurmail_pidm, gurmail_matl_code_mod How I can modify this query or let me know if you have other ideas..
Thank youHello
try this,
SQL> with tab as(Select 1135711 GURMAIL_PIDM, Null CODE1 from dual Union All
2 Select 1135711 GURMAIL_PIDM, '8IBD' CODE1 from dual Union All
3 Select 1135711 GURMAIL_PIDM, '8IBW' CODE1 from dual)
4 SELECT GURMAIL_PIDM || sys_connect_by_path(CODE1,' ') Result
5 FROM (SELECT GURMAIL_PIDM
6 ,code1
7 ,row_number() over(Partition BY GURMAIL_PIDM Order BY GURMAIL_PIDM) rn
8 FROM tab)
9 WHERE connect_by_isleaf = 1
10 Start With rn = 1
11 Connect BY Prior rn = rn - 1;
RESULT
1135711 8IBW 8IBDHope this helps
Christian Balz -
Hellou
I need help in SQLPLUS. I need to prompt into the file one row of information like this:
0000004202;;00151564;[email protected];160120071333
this -> 0000004202;;00151564;[email protected]; is just static text
this -> 160120071333 is date in format (ddmmyyyyHHMM)
And I need it in one row
prompt 0000004202;;00151564;[email protected]; select to_char(sysdate,'ddmmyyyyHH24MM') from dual
does not work
Can you help me?
I used something Like this:
spool file
declare cas_aktual VARCHAR(12);
begin
select to_char(sysdate,'ddmmyyyyHH24MM') into cas_aktual from dual;
dbms_output.enable;
dbms_output.put_line('blabla'||cas_aktual||'konec');
end;
spool OFF
But it isn't work too>
I used something Like this:
spool file
declare cas_aktual VARCHAR(12);
begin
select to_char(sysdate,'ddmmyyyyHH24MM') into
cas_aktual from dual;
dbms_output.enable;
dbms_output.put_line('blabla'||cas_aktual||'konec');
end;
spool OFF
But it isn't work tooYou need a forward-slash character ("/") right after the PL/SQL block to allow sqlplus to run the contents of the buffer.
test@ora>
test@ora> spool c:\test.log
test@ora>
test@ora> declare cas_aktual VARCHAR(12);
2 begin
3 select to_char(sysdate,'ddmmyyyyHH24MM') into cas_aktual from dual;
4 dbms_output.enable;
5 dbms_output.put_line('blabla'||cas_aktual||'konec');
6 end;
7 /
blabla300720081207konec
PL/SQL procedure successfully completed.
test@ora>
test@ora> spool OFF
test@ora>
test@ora> host type c:\test.log
test@ora>
test@ora> declare cas_aktual VARCHAR(12);
2 begin
3 select to_char(sysdate,'ddmmyyyyHH24MM') into cas_aktual from dual;
4 dbms_output.enable;
5 dbms_output.put_line('blabla'||cas_aktual||'konec');
6 end;
7 /
blabla300720081207konec
PL/SQL procedure successfully completed.
test@ora>
test@ora> spool OFF
test@ora>
test@ora>isotope -
Hello,
I hope some1 can help me for these.
I am using apex 3.1.2 ver
My first question: how can I put more columns for example 4 columns with heading in one row? when I do, screen is too wide but i do not want scrolling?
e.g
aaaaaaaaaaaaaaa( ) bbbbbbbbbbbbbb ( ) ccccccccccccccccc ( ) ddddddddddd( )
second question?
how can i display second column value based on first column value before saving the page?
e.g. aaaaaaa(1) bbbbbbbb(should display text value based on first column)
for example 1 - abc
2 - def
3 - ghi and so on.
last question? how can i disable the column? should column enable based on other column? e.g if a then second column take value other disabled?
Many thx.
kind regards,Irha10 wrote:
how can I put more columns for example 4 columns with heading in one row? when I do, screen is too wide but i do not want scrolling?In item property change "Begin on new Line " to "Yes"
Irha10 wrote:
how can i display second column value based on first column value before saving the page?01. You have to create a branch to same page
02. Submit the page using any event (such as button press or something). So when you enter details to first item and then press button then page will submit and reload the same page.
03. In the page create a before region process and check whether second item is not null and third item is null then populate third item. Then first item is not null and second item null then populate second item.
Irha10 wrote:
? how can i disable the column? should column enable based on other column? e.g if a then second column take value other disabled?You can use a java script and enable and dissable item based on any condition such as value of another item
Example
if ($x('P16_YYY').value !='SOME VALUE')
$x('P16_XXX').disabled = true;
}else
$x('P16_XXX').disabled = false;
} -
Hi all,
I want to display all the party codes which have same party name,
and I want to display all the party codes in one row separated by comma. is it possible?You can either use analytic functions + hierarchy or stragg (listagg if you are on 11.2) or undocumentd wm_concat. There are plenty examples on this forum. For example:
select deptno,
ltrim(sys_connect_by_path(job,','),',') job_list
from (
select deptno,
job,
row_number() over(partition by deptno order by job) rn
from emp
where connect_by_isleaf = 1
start with rn = 1
connect by deptno = prior deptno
and rn = prior rn + 1
DEPTNO JOB_LIST
10 CLERK,MANAGER,PRESIDENT
20 ANALYST,ANALYST,CLERK,CLERK,MANAGER
30 CLERK,MANAGER,SALESMAN,SALESMAN,SALESMAN,SALESMAN
select deptno,
rtrim(stragg(job || ','),',') job_list
from emp
group by deptno
DEPTNO JOB_LIST
10 MANAGER,PRESIDENT,CLERK
20 CLERK,ANALYST,CLERK,ANALYST,MANAGER
30 SALESMAN,MANAGER,SALESMAN,SALESMAN,CLERK,SALESMAN
select deptno,
wm_concat(job) job_list
from emp
group by deptno
DEPTNO JOB_LIST
10 MANAGER,PRESIDENT,CLERK
20 CLERK,ANALYST,CLERK,ANALYST,MANAGER
30 SALESMAN,MANAGER,SALESMAN,SALESMAN,CLERK,SALESMANSY. -
Displaying records in one row??
The Board table has the following columns Userrecordid,Board_codes and the data is being displayed as:
Here is the data in the Boards Table:
Userrecordid Board_codes Board_Number
m001 KBIM A1234
m001 PBIM B1234
m002 PBIM Dytu1
m003 PBIM io34I had written a query(splitting KBIM code data & PBIM code data which actually brought back results as seen below:
KBIM (Y/N) KBIM # PBIM (Y/N) PBIM #
Y A1234 NULL NULL
NULL NULL Y B1234I need to display the above results in one row shown as below:
KBIM (Y/N) KBIM # PBIM (Y/N) PBIM #
Y A1234 Y B1234Hi,
francislazaro wrote:
The Board table has the following columns Userrecordid,Board_codes and the data is being displayed as:
Here is the data in the Boards Table:
Userrecordid Board_codes Board_Number
m001 KBIM A1234
m001 PBIM B1234
m002 PBIM Dytu1
m003 PBIM io34...
I need to display the above results in one row shown as below:
KBIM (Y/N) KBIM # PBIM (Y/N) PBIM #
Y A1234 Y B1234
So you don't want anything in the results about userrecordids 'm002' and 'm003', because they do not have both board_codes 'KBIM' and 'PBIM', is that it?
One way to get those results is a self-join, as if all the rows with borad_code 'KBIM' were in one table, and all the rows with borad_code 'PBIM' were in another:
SELECT 'Y' AS "KBIM (Y/N)"
, k.boradnumber AS "KBIM #"
, 'Y' AS "PBIM (Y/N)"
, k.boradnumber AS "KBIM #"
FROM boards k
JOIN boards p ON k.userrecordid = p.usrrecordid
WHERE k.board_codes = 'KBIM'
AND p.board_codes = 'PBIM'
;Another way is a GROUP BY, like Mpautom suggested.
If your requirements change in the future, so that you need to include all rows, even if they don't have both board_codes, then you could change the JOIN to a FULL OUTER JOIN and make what I wrote as the WHERE clause part of the join condition, but I suspect the GROUP BY approach would be more efficient in that case.
Maybe you are looking for
-
Get rid of "Unsorted Bookmarks" in FF 30
FF 30 apparently has this hard coded. "Unsorted Bookmarks" is now at the end of my nicely sorted list. I would like to get rid of it, delete it permanently, kick it to the curb. It's kind of lousy having this thing hanging out there. I'm running Linu
-
Question about download file in OAS4
Question about download file in OAS4: I use Oracle Application Server 4.0.7 on my Windows NT 4.0 SP6; I use PL/Sql Cartridge developer a document system; It's use the upload/download in PL/Sql Cartridge; I read the document , the Upload/download in P
-
IS there a way to play DVD's on an IMac and to watch on a HDTV using Apple TV as the bridge?
-
Hi, Client want some report for purchasing document. How can i get this in standard system. 1) List of purchase order with different tollerence limit than material master record. 2) List of purchase order with different payment terms than vendor
-
Importing .avi (.xvid) audio only, basically no video
[post deleted by forum host] Please read the forum rules and terms of use again.