EJBQL for Joining two tables
I am using CMP and CMR with a project. Two of the entity beans have a many-to-many relationship with each other, and I am trying to specify the finder methods in EJBQL. One of the entity beans is Event, and the other is Attendee. The Event bean contains an attendees attribute, which is a Collection of Attendee.
The finder method I'm specifying looks like this:
SELECT DISTINCT OBJECT(e) FROM Event e,
IN (e.attendees) AS a
WHERE a = ?1 AND e.day = ?2
A similar finder is specified in the following way:
SELECT DISTINCT OBJECT(e) FROM Event e,
IN (e.attendees) AS a
WHERE a = ?1
The first finder method fails, but the second version is successful.
The problem manifests as a runtime exception:
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.ejb.EJBException: nested exception is: SQL Exception: Syntax error: Encountered "WHERE" at line 1, column 167.
javax.ejb.EJBException: nested exception is: SQL Exception: Syntax error: Encountered "WHERE" at line 1, column 167.
SQL Exception: Syntax error: Encountered "WHERE" at line 1, column 167.
The generated SQL looks like this:
SELECT DISTINCT "e"."eventId" FROM "EventEntityTable" "e" , "AttendeeEntityTable" "a" , "EventEJB_attendees_AttendeeEJB_eventsTable" "@tmp0" WHERE ( EXISTS (SELECT * WHERE (("e.attendees"."_AttendeeEJB_userId" = ? ))) AND ("e"."day" = ? )) AND (("e"."eventId" = "@tmp0"."_EventEJB_eventId" AND "@tmp0"."_AttendeeEJB_userId" = "a"."userId"))
Any ideas as to why this is happening, and what I can do to fix it?
Similar Messages
-
How to develop Framework Extension for join two tables
Dear developers,
My project contains more than 200 maintenance tables.
Maintenance tables are very small and less than 100 lines.
Maintenance tables mostly associated with a translation table.
Translation tables are used for localized texts.
Translation tables consists of Master Table Key + LanguageKey.
I want to edit customizing tables only session language as single table.
Translation table row may or may not be. Thats mean relationship is 1 to 0..1.
ADF table control ignore this relationship.
I tried view link between master view and detail view objects, but if translation table line is empty ADF table control throws translation iterator is null exception.
I tried entity based left joined editable view I get view link inconsisty problem.
In this case, the BC forcing me to framework extension.
How is develop solution?topic is update
-
Join two tables, return max 1 record for each left
I want to join tables A and B, but I only want to return a maximum of one record for each record on the left. For example
Table A
Bob,1
John,2
Jill,3
Table B
1,MountainTime
1,MountainTime
2,CentralTime
3,PacificTime
Result
Bob,MountainTime
John,CentralTime
Jill,PacificTimeHi Andrew,
Create a report by joining two tables and insert a group on code(1) and place your fields on goup footer.
This will give only one record.
Thanks,
Sastry -
I am trying to develop a query in MS Access 2010 to join two tables using three joins, one of which is a (between) date range. The tables are contained in Access. The reason
the tables are contained in access because they are imported from different ODBC warehouses and the data is formatted for uniformity. I believe this cannot be developed using MS Visual Query Designer. I think writing a query in SQL would be suiting this project.
ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2.
[ABCTABLE]
ABCORDER
ABCPART
ABCSERIAL
ABCDATE
[ZYXTABLE]
XYZORDER
XYZPART
XYZSERIAL
XYZDATE1
XYZDATE2Thank you for the looking at the post. The actual table names are rather ambiguous. I renamed them so it would make more sense. I will explain more and give the actual names. What I do not have is the actual data in the table. That is something I don't have
on this computer. There are no "Null" fields in either of the tables.
This table has many orders (MSORDER) that need to match one order (GLORDER) in GLORDR. This is based on MSPART joined to GLPART, MSSERIAL joined to GLSERIAL, and MSOPNDATE joined if it falls between GLSTARTDATE and GLENDDATE.
[MSORDR]
MSORDER
MSPART
MSSERIAL
MSOPNDATE
11111111
4444444
55555
2/4/2015
22222222
6666666
11111
1/6/2015
33333333
6666666
11111
3/5/2015
This table has one order for every part number and every serial number.
[GLORDR]
GLORDER
GLPART
GLSERIAL
GLSTARTDATE
GLENDDATE
ABC11111
444444
55555
1/2/2015
4/4/2015
ABC22222
666666
11111
1/5/2015
4/10/2015
AAA11111
555555
22222
3/2/2015
4/10/2015
Post Query table
GLORDER
MSORDER
GLSTARTDATE
GLENDDATE
MSOPNDATE
ABC11111
11111111
1/2/2015
4/4/2015
2/4/2015
ABC22222
22222222
1/5/2015
4/10/2015
1/6/2015
ABC22222
33333333
1/5/2015
4/10/2015
3/5/2015
This is the SQL minus the between date join.
SELECT GLORDR.GLORDER, MSORDR.MSORDER, GLORDR.GLSTARTDATE, GLORDR.GLENDDATE, MSORDR.MSOPNDATE
FROM GLORDR INNER JOIN MSORDR ON (GLORDR.GLSERIAL = MSORDR.MSSERIAL) AND (GLORDR.GLPART = MSORDR.MSPART); -
Using a view to join two tables
Thank you in advance for any advice you can lend.
I am using this code in my MySQL db to create a view.
select
job.id as job_id,
umr_cost_calculation.plant_name,
max(umr_cost_calculation.id) as max_id
from
job,
umr_cost_calculation
where
job.id = umr_cost_calculation.job_id
group by job.id , umr_cost_calculation.plant_name
I did this so I can join two tables and pull in the most current cost data for a specific plant. The report will, at times, show the wrong (older) data. I can re-run the report, filter to just the one job and see again the wrong data. When I add the max_id to the report, it display the id and updates the report with the correct data. It appears that the view was stale and by adding the ID to the report this fixed the issue.
1) Is this the best way to make this join? I don't see how Crystal supports a subquery to make a join (this is why I used the view).
2) If I leave the max_id on the report, will this force the view to always update?Try:
Select
D1.EmpLoginID,
Count(D1.ID),
Count(D1.AlarmCode),
D1.EmpName,
D1.EmpAddress,
D2.Db2Count
FROM DB1.Data D1
LEFT JOIN (SELECT
empLoginID, Count(*) as Db2Count
FROM DB2.ALL_Database
WHERE site = 'Atlanta'
GROUP BY empLoginID
) D2
ON D1.EmpLoginID = D2.EmpLoginID
GROUP BY D1.empLoginID, D1.EmpName, D2.EmpAddress, D2.Db2Count
Order BY D1.empLoginID ASC
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
How do you join two tables from different Oracle schemas using a subquery
I am trying to join two tables from different Oracle schemas using a subquery. I can extract data from each of the tables without a problem. However, when I combine the select statements using a subquery I get the Oracle error *'ORA-00936: missing expression'*. Since each SELECT statement executes on its own without error I don't understand what is missing. The result set I am trying to get is to match up the LINE_ID from PDTABLE_12_1 in schema DD_12809 with the MAT_DESCRIPTION from table PDTABLE_201 in schema RA_12809.
The query is as follows:
sql = "SELECT [DD_12809].[PDTABLE_12_1].LINE_ID FROM [DD_12809].[PDTABLE_12_1] JOIN " _
+ "(SELECT [RA_12809].[PDTABLE_201].MAT_DESCRIPTION " _
+ "FROM [RA_12809].[PDTABLE_201]) AS FAB " _
+ "ON [DD_12809].[PDTABLE_12_1].PIPING_MATER_CLASS = FAB.PIPING_MATER_CLASS"
The format of the query is copied from a SQL programming manual.
I also tried executing the query using a straight JOIN on the two tables but got the same results. Any insight would be helpful. Thanks!
Edited by: user11338343 on Oct 19, 2009 6:55 AMI believe you are receiving the error because you are trying to JOIN on a column that doesn't exist. For example you are trying to join on FAB.PIPING_MATER_CLASS but that column does not exist in the subquery.
If you want to do a straight join without a subquery you could do the following
SELECT DD_12809.PDTABLE_12_1.LINE_ID
, FAB.MAT_DESCRIPTION
FROM DD_12809.PDTABLE_12_1
JOIN RA_12809.PDTABLE_201 AS FAB ON DD_12809.PDTABLE_12_1.PIPING_MATER_CLASS = FAB.PIPING_MATER_CLASS HTH! -
How to prevent Oracle from using an index when joining two tables ...
How to prevent Oracle from using an index when joining two tables to get an inline view which is used in an update statement?
O.K. I think I have to explain what I mean:
When joining two tables which have many entries sometimes it es better not to use an index on the column used as join criteria.
I have two tables: table A and table B.
Table A has 4.000.000 entries and table B has 700.000 entries.
I have a join of both tables with a numeric column as join criteria.
There is an index on this column in table A.
So I instead of
where (A.col = B.col)I want to use
where (A.col+0 = B.col)in order to prevent Oracle from using the index.
When I use the join in a select statement it works.
But when I use the join as inline view in an update statement I get the error ORA-01779.
When I remove the "+0" the update statement works. (The column col is unique in table B).
Any ideas why this happens?
Thank you very much in advance for any help.
Regards HartmutI think you should post an properly formatted explain plan output using DBMS_XPLAN.DISPLAY including the "Predicate Information" section below the plan to provide more details regarding your query resp. update statement. Please use the \[code\] and \[code\] tags to enhance readability of the output provided:
In SQL*Plus:
SET LINESIZE 130
EXPLAIN PLAN FOR <your statement>;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);Usually if you're using the CBO (cost based optimizer) and have reasonable statistics gathered on the database objects used the optimizer should be able to determine if it is better to use the existing index or not.
Things look different if you don't have statistics, you have outdated/wrong statistics or deliberately still use the RBO (rule based optimizer). In this case you would have to use other means to prevent the index usage, the most obvious would be the already mentioned NO_INDEX or FULL hint.
But I strongly recommend to check in first place why the optimizer apparently seems to choose an inappropriate index access path.
Regards,
Randolf
Oracle related stuff:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle:
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Joining two tables in PL/SQL
Hi there,
I have two problems...first being:
We are trying to run a sub-query within a WHERE/AND clause. I am not sure on the correct syntax on how to run the sub-query as denoted in the code below. Secondly I am trying to join two tables with a common column name (ie: CIPIDI_NR). Considering I cant fix the first problem I cant test out the sub-query. So any help on either would be grateful. Cheers
Select *
from TBL_CIPIDI
WHERE CIPIDI_NR like nvl ('in_case_number%', CIPIDI_NR)
AND CIPIDI_NAME like nvl ('in_case_name%', CIPIDI_NAME)
AND COST_CENTRE LIKE NVL ('in_cost_centre%', COST_CENTRE)
AND CIPIDI_DESCRIPTION like nvl ('in_description%', CIPIDI_DESCRIPTION)
AND CLAIMANT_NAME LIKE NVL ('in_claimant%', CLAIMANT_NAME)
AND REQUESTOR LIKE NVL ('in_requestor%', REQUESTOR)
AND PROJECT_MANAGER LIKE NVL ('in_project_manager%', PROJECT_MANAGER)
AND TEAM_LEADER LIKE NVL ('in_team_leader%', TEAM_LEADER)
AND ********RUN THE QUERY BELOW************
SELECT C1.CIPIDI_NR, C2.CIPIDI_NR
from TBL_TEAM_MEMBERS C1, TBL_CIPIDI C2
WHERE C1.CIPIDI_NR = C2.CIPIDI_NR
AND TEAM_MEM_NAME LIKE NVL ('in_team_mem_name%', TEAM_MEM_NAME)
);You really need to start providing create table and insert statements for tables and sample data for testing, the results that you want based on that data in order to clarify the problem, your Oracle version, and a copy and paste of an attempted run of your code, complete with any error messages received. The following is my best guess at what you might be looking for.
Select *
from TBL_TEAM_MEMBERS C1, TBL_CIPIDI C2
WHERE C1.CIPIDI_NR = C2.CIPIDI_NR
AND c1.CIPIDI_NR like nvl (in_case_number || '%', c1.CIPIDI_NR)
AND c1.CIPIDI_NAME like nvl (in_case_name || '%', c1.CIPIDI_NAME)
AND c1.COST_CENTRE LIKE NVL (in_cost_centre || '%', c1.COST_CENTRE)
AND c1.CIPIDI_DESCRIPTION like nvl (in_description || '%', c1.CIPIDI_DESCRIPTION)
AND c1.CLAIMANT_NAME LIKE NVL (in_claimant || '%', c1.CLAIMANT_NAME)
AND c1.REQUESTOR LIKE NVL (in_requestor || '%', c1.REQUESTOR)
AND c1.PROJECT_MANAGER LIKE NVL (in_project_manager || '%', c1.PROJECT_MANAGER)
AND c1.TEAM_LEADER LIKE NVL (in_team_leader || '%', c1.TEAM_LEADER)
AND TEAM_MEM_NAME LIKE NVL (in_team_mem_name || '%', TEAM_MEM_NAME); -
Joining two tables, sql query
This is a newbie question! I would like to join two tables. Table_1 contains xml stylesheets:
id stylesheet doc
1 <xml stylesheet doc A>
2 <xml stylesheet doc B>
And Table_2 contains the XML documents that the stylesheets will transform:
id XML doc
1 <XML document 1>
1 <XML document 2>
1 <XML document 3>
2 <XML document 4>
2 <XML document 5>
I would like <xml stylesheet doc A> to transform only XML doc that have an id of 1, so I tried this sql statement:
select a.stylesheet_doc ,b.xml_doc from Table_1 a, Table_2 b where a.id=b.id and a.id=1;
This statement returns the rows I want (stylesheet doc with id equals 1, and xml_doc with id equals 1), but it pairs each xml document with a style sheet.
stylesheet doc A <XML document 1>
stylesheet doc A <XML document 2>
stylesheet doc A <XML document 3>
My question is, is there a way to have a result that looks like this?
stylesheet doc A
<XML document 1>
<XML document 2>
<XML document 3>
That is, is there a way in sql to get rid of duplicate stylesheet doc A?
I have tried group by and rollup and xmlagg.
Thank you very, very much for your help.
JimHi, Jim,
Welcome to the forum!
You just want to display the XML, not actually transform it, right?
GROUP BY ROLLUP should work, but I find it easier with GROUP BY GROUPING SETS. Here's an example from tables in the scott schema:
SELECT CASE
WHEN GROUPING (ename) = 1
THEN d.dname
END AS dname
, e.ename
FROM scott.dept d
JOIN scott.emp e ON d.deptno = e.deptno
GROUP BY GROUPING SETS ( (d.dname, e.ename)
, (d.dname)
ORDER BY d.dname
, ename NULLS FIRST
;Output:
DNAME ENAME
ACCOUNTING
CLARK
KING
MILLER
RESEARCH
ADAMS
FORD
JONES
SCOTT
SMITH
SALES
ALLEN
BLAKE
JAMES
MARTIN
TURNER
WARDYou may have noticed that this site noramlly compresses whitespace.
Whenever you post formatted text (such as query results) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing. -
Hi
I am beginner in Oracle. I want some help in joining two tables and adding a new attribute to the resulting table
For xample:
Table Name: Texas*
Ename Enumber Sal
John 1 10
Akl 2 20
Renka 3 25
Table Name: California_
Ename Enumber Sal
Rada 4 15
Paul 5 16
Mikler 6 12
Now I want to join these Tables Texas and California and I want to Add Another attribute to the resulting table State
Table Name: Emplyee_
Ename Enumber Sal State
John 1 10 Texas
Akl 2 20 Texas
Renka 3 25 Texas
Rada 4 15 California
Paul 5 16 California
Mikler 6 12 California
Thanks in advance
Santosh
Edited by: user10904473 on Mar 29, 2009 2:45 PMAre you sure you want to join the tables? It seems like you want to UNION them
SELECT ename, enumber, sal, 'Texas' state
FROM texas
UNION ALL
SELECT ename, enumber, sal, 'California' state
FROM californiaOf course, having different tables for different states is a very poor way to model employee data, so I'd strongly suggest fixing that problem if these are real tables rather than a school assignment.
Justin -
Joining two tables using PL/SQL
here i am trying to join two tables can any one tell me what is wrong with this syntex
CREATE OR REPLACE PROCEDURE test IS
CURSOR c1 IS SELECT seq,fname,lname from t1;
CURSOR c2 IS SELECT seq1,q,a from t2;
userjob number;
BEGIN
OPEN c1;
insert into t3 values(c1.seq,c1.fname,c1.lname);
FETCH c1.seq INTO userjob;
FOR c1rec IN c2 LOOP
IF (c1rec.seq=c1.seq and c1rec.q1='why') THEN
insert into t3 values(c1rec.q1,c1rec.a1);
elsif (c1rec.seq=c1.seq and c1rec.q1='what') then
insert into t3 values(c1rec.q2,c1rec.a2);
elsif (c1rec.seq=c1.seq and c1rec.q1='when') then
insert into t3 values(c1rec.q3,c1rec.a3);
elsif (c1rec.seq=c1.seq and c1rec.q1='where') then
insert into t3 values(c1rec.q4,c1rec.a4);
END IF;
END LOOP;
END;
/You should always fetch a cursor before using it's values. All columns in the select should be fetched into variables or a record-variable. You can't refer to the cursor-columns values with c1.seq etc.
r1 c1%rowtype;
l_found boolean;
BEGIN
OPEN c1;
FETCH c1 INTO r1;
insert into t3 values(r1.seq,r1.fname,r1.lname);
l_found := c1%found;
close c1;
if l_found
then
It is also better to close the cursor and check if the select resulted in a row. With this code you will only retrieve one row even if the select will result in multiple rows.
But I agree with all the others that this can probably be done more efficiently with one SQL statement. -
Joining two tables LIKP and VBUK
HI,
I want to join two tables LIKP and VBUK, can u give some explaination ?
points will be given for good answers...
regards
VijayaHi,
see this example of joining two tables zairln & zflight.
These 2 tables are logically joined by the airln field.
Select a~airln
a~lnnam
b~fligh
b~cntry
Into table int_airdet
From zairln as a inner join zflight as b on aairln = bairln.
In order to restrict the data as per the selection criteria, a where clause can be added to the above inner join.
rgds,
latheesh
Message was edited by: Latheesh Kaduthara -
Joining Two Tables based on Conditions.
Hi All,
i would like to join two tables emp and dept with conditional join like
for example: select emp.column1...............
left outer join DEPT ON if Dept.column1='A" then emp.column1=dept.column1
else emp.column2=dept.column3
i know that bu using the UNION we can dothis, but i donot want to USE UNION.
please let me know if any workaround for this.
Thanks,
KalyanSQL> select * from etl
2 /
EMPNO ENAME JOB MGR SAL COMM DEPTNO AAA DEPT_NO
7566 JONES MANAGER 7839 2975 20 2 20
7654 MARTIN SALESMAN 7698 1250 1400 30 3 10
7698 BLAKE MANAGER 7839 2850 30 3 10
7782 CLARK MANAGER 7839 2450 10 1 20
7788 SCOTT ANALYST 7566 3000 20 2 20
7839 KING PRESIDENT 5000 10 1 20
7844 TURNER SALESMAN 7698 1500 30 3 10
7876 ADAMS CLERK 7788 1100 20 2 20
7900 JAMES CLERK 7698 950 30 3 10
7902 FORD ANALYST 7566 3000 20 2 20
7934 MILLER5 CLERK 7782 1300 10 1 20
7936 MILLER7 CLERK 7782 1300 10 1 20
12 rows selected.
SQL> select * from dept;
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> ed
Wrote file afiedt.buf
1 select
2 e.empno,
3 e.ename,
4 e.deptno,
5 aaa,
6 e.dept_no,
7 d.deptno,
8 d.dname
9 from
10 etl e ,
11 dept d
12 where
13 (e.aaa =1 and e.deptno = d.deptno) or
14* (e.aaa =2 and e.dept_no =d.deptno)
SQL> /
EMPNO ENAME DEPTNO AAA DEPT_NO DEPTNO DNAME
7566 JONES 20 2 20 20 RESEARCH
7788 SCOTT 20 2 20 20 RESEARCH
7876 ADAMS 20 2 20 20 RESEARCH
7902 FORD 20 2 20 20 RESEARCH
7782 CLARK 10 1 20 10 ACCOUNTING
7839 KING 10 1 20 10 ACCOUNTING
7934 MILLER5 10 1 20 10 ACCOUNTING
7936 MILLER7 10 1 20 10 ACCOUNTING
8 rows selected.Regards
Singh -
Want to Join two tables with cursors
Can anyone tell me how to join two tables only by cursors.
Not with:
1.Joining condition
2.Procedure etc.
Only cursors with passing parameters.
SowmyaThis is my assignment. I want to get the matching records from both tables. I have pk, fk for both tables for deptno.Can I pass parameter for this.
dept table:
deptno deptname
10 sales
20 Erp
30 hr
40 marketing
emp table:
Empno deptno Name
1 10 lee
2 20 hans
3 10 peter
4 30 james
5 30 king
Output should be:
deptno empname empno deptname
10 lee 1 sales
10 peter 3 erp
30 james 4 hr
30 king 5 marketing -
hi
how to join two tables using inner join if the first table has two primary keys and second table has 3 primary keysWould describe type of joins in ABAP, which might differ with other joins.
The join syntax represents a recursively nestable join expression. A join expression consists of a left-hand and a right- hand side, which are joined either by means of INNER JOIN or LEFT OUTER JOIN. Depending on the type of join, a join expression can be either an inner (INNER) or an outer (LEFT OUTER) join. Every join expression can be enclosed in round brackets. If a join expression is used, the SELECT command circumvents SAP buffering.
On the left-hand side, either a single database table, a view dbtab_left, or a join expression join can be specified. On the right-hand side, a single database table or a view dbtab_right as well as join conditions join_cond can be specified after ON. In this way, a maximum of 24 join expressions that join 25 database tables or views with each other can be specified after FROM.
AS can be used to specify an alternative table name tabalias for each of the specified database table names or for every view. A database table or a view can occur multiple times within a join expression and, in this case, have various alternative names.
The syntax of the join conditions join_cond is the same as that of the sql_cond conditions after the addition WHERE, with the following differences:
At least one comparison must be specified after ON.
Individual comparisons may be joined using AND only.
All comparisons must contain a column in the database table or the view dbtab_right on the right-hand side as an operand.
The following additions not be used: NOT, LIKE, IN.
No sub-queries may be used.
For outer joins, only equality comparisons (=, EQ) are possible.
If an outer join occurs after FROM, the join condition of every join expression must contain at least one comparison between columns on the left-hand and the right-hand side.
In outer joins, all comparisons that contain columns as operands in the database table or the view dbtab_right on the right-hand side must be specified in the corresponding join condition. In the WHERE condition of the same SELECT command, these columns are not allowed as operands.
Resulting set for inner join
The inner join joins the columns of every selected line on the left- hand side with the columns of all lines on the right-hand side that jointly fulfil the join_cond condition. A line in the resulting set is created for every such line on the right-hand side. The content of the column on the left-hand side may be duplicated in this case. If none of the lines on the right-hand side fulfils the join_cond condition, no line is created in the resulting set.
Resulting set for outer join
The outer join basically creates the same resulting set as the inner join, with the difference that at least one line is created in the resulting set for every selected line on the left-hand side, even if no line on the right-hand side fulfils the join_cond condition. The columns on the right-hand side that do not fulfil the join_cond condition are filled with null values.
Note
If the same column name occurs in several database tables in a join expression, they have to be identified in all remaining additions of the SELECT statement by using the column selector ~.
Example
Join the columns carrname, connid, fldate of the database tables scarr, spfli and sflight by means of two inner joins. A list is created of the flights from p_cityfr to p_cityto. Alternative names are used for every table.
PARAMETERS: p_cityfr TYPE spfli-cityfrom,
p_cityto TYPE spfli-cityto.
DATA: BEGIN OF wa,
fldate TYPE sflight-fldate,
carrname TYPE scarr-carrname,
connid TYPE spfli-connid,
END OF wa.
DATA itab LIKE SORTED TABLE OF wa
WITH UNIQUE KEY fldate carrname connid.
SELECT ccarrname pconnid f~fldate
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( ( scarr AS c
INNER JOIN spfli AS p ON pcarrid = ccarrid
AND p~cityfrom = p_cityfr
AND p~cityto = p_cityto )
INNER JOIN sflight AS f ON fcarrid = pcarrid
AND fconnid = pconnid ).
LOOP AT itab INTO wa.
WRITE: / wa-fldate, wa-carrname, wa-connid.
ENDLOOP.
Example
Join the columns carrid, carrname and connid of the database tables scarr and spfli using an outer join. The column connid is set to the null value for all flights that do not fly from p_cityfr. This null value is then converted to the appropriate initial value when it is transferred to the assigned data object. The LOOP returns all airlines that do not fly from p_cityfr.
PARAMETERS p_cityfr TYPE spfli-cityfrom.
DATA: BEGIN OF wa,
carrid TYPE scarr-carrid,
carrname TYPE scarr-carrname,
connid TYPE spfli-connid,
END OF wa,
itab LIKE SORTED TABLE OF wa
WITH NON-UNIQUE KEY carrid.
SELECT scarrid scarrname p~connid
INTO CORRESPONDING FIELDS OF TABLE itab
FROM scarr AS s
LEFT OUTER JOIN spfli AS p ON scarrid = pcarrid
AND p~cityfrom = p_cityfr.
LOOP AT itab INTO wa.
IF wa-connid = '0000'.
WRITE: / wa-carrid, wa-carrname.
ENDIF.
ENDLOOP.
Maybe you are looking for
-
gifted a playlist and reciepant is having trouble downloading it?
-
Problem in displaying two fields in dropdown on selection screen
Hi All, I have a reqmt where i need to display the dropdown list for certain field. For this perticular fields there is a description attached to it. Please let me know teh way where i can display the field with description in dropdown. Like field1
-
How do I make a bug report visible to others?
I submitted a bug report and the conformation came back as follows: Your report has been assigned an internal review ID of: 164090 This review ID is NOT visible on the "Java Developer Connection" (JDC). How do I make this bug report visible to others
-
Add or edit Sequence Call step(s) dynamically in a sequence
Hello I have looked at the TestStand Example: SequenceBuilderTool In the <TestStand>\Examples\SequenceBuilderTool Folder It works great, but I cannot seem to be able to use this for a Sequence Call Step. Any Solutions? Thanks BRI NI
-
Hi, There is a way to audit data changes in a MaxDB instance, and save a history of what was changed? Regards Clóvis