Can we join table with structure
Hi
i have taken fields from Plaf table and some fields from structures so now i want to join that how can i join.
Is there any option?
regards
Hi,
structure dont have any data base table associated with them so they dont have any data.
that's why we cannot join structure witha table but we can include a structure within any table.
Sytex to include structure in ztable:
fieldname data element.
.include struname
hope it will ans ur query.
Thanks
Rajesh Kumar
Similar Messages
-
How can i join table with multiple colums
This is my Data-----------------------------------------------------DECLARE @StockIn TABLE
InID INT ,
StockID INT ,
InQty DECIMAL(16, 2) ,
Price DECIMAL(16, 2) ,
tranDate DATE ,
running INT
DECLARE @StockOut TABLE
OutID INT ,
StockID INT ,
OutQty DECIMAL(16, 2) ,
lineid INT ,
tranDate DATE
INSERT INTO @StockIn ( InID, StockID, InQty, Price, tranDate, running )
VALUES ( 1, 1, 15, 430, '2014-10-09', 1 ),
( 2, 1, 10, 431, '2014-10-10', 2 ),
( 3, 1, 15, 432, '2015-02-02', 3 ),
( 4, 2, 15, 450, '2014-08-05', 1 ),
( 5, 2, 6, 450, '2014-10-01', 2 ),
( 6, 2, 15, 452, '2015-10-02', 3 )
INSERT INTO @StockOut ( OutID, StockID, OutQty, lineid, tranDate )
VALUES ( 1, 1, 20, 2, '2014-10-11' ),
( 2, 1, 10, 4, '2014-10-12' ),
( 3, 2, 12, 8, '2014-11-01' ),
( 4, 2, 3, 8, '2014-11-02' );--------------------------------------------------------------------This is my query for calculate the total remaining of stock of any stockID-------------------------------------------------------------------- WITH RunningTotals as (
select StockID , Qty , price , total , total - qty AS PrevTotal, TranDate , rn FROM (
select
StockID, InQty AS QTY , Price
, SUM(InQty) over (PARTITION BY StockID order by tranDate , inQty DESC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as Total
,ROW_NUMBER() OVER (PARTITION BY StockID ORDER BY tranDate , inQty DESC ) as rn
,TranDate --,TranID, TxnType
from @StockIn ) A -- runing stockID in stock order by tranDate
) , TotalOut as (
SELECT StockID , Sum(OutQty) AS QTY
FROM @StockOut
GROUP BY StockID -- Sum of outQty group by StockID
) , GrandTotal as
select
rt.StockID , rt.QTY AS original ,SUM(CASE WHEN PrevTotal > isNULL(out.Qty, 0) THEN rt.Qty ELSE rt.Total - isNULL(out.Qty, 0) END) AS QTY , Price , SUM(CASE WHEN PrevTotal > isNULL(out.Qty, 0) THEN rt.Qty ELSE rt.Total - isNULL(out.Qty, 0) END * Price) AS Ending , rt.TranDate from
RunningTotals rt
left join
TotalOut out
on
rt.StockID = out.StockID
where rt.Total > isNull(out.Qty , 0)
group by rt.StockID , Price , rt.TranDate , rt.QTY -- running OutQty out of inQty of any stockID
) Select * from GrandTotal order by stockID ------------------------------------------------------------
This query is run the total remaining of stock exactly right. But if i try to get the OutQty of stockID of any Line (lineid)The query duplicate data. this is Example------------------------------------------------------------ DECLARE @StockIn TABLE
InID INT ,
StockID INT ,
InQty DECIMAL(16, 2) ,
Price DECIMAL(16, 2) ,
tranDate DATE ,
running INT
DECLARE @StockOut TABLE
OutID INT ,
StockID INT ,
OutQty DECIMAL(16, 2) ,
lineid INT ,
tranDate DATE
INSERT INTO @StockIn ( InID, StockID, InQty, Price, tranDate, running )
VALUES ( 1, 1, 15, 430, '2014-10-09', 1 ),
( 2, 1, 10, 431, '2014-10-10', 2 ),
( 3, 1, 15, 432, '2015-02-02', 3 ),
( 4, 2, 15, 450, '2014-08-05', 1 ),
( 5, 2, 6, 450, '2014-10-01', 2 ),
( 6, 2, 15, 452, '2015-10-02', 3 )
INSERT INTO @StockOut ( OutID, StockID, OutQty, lineid, tranDate )
VALUES ( 1, 1, 20, 2, '2014-10-11' ),
( 2, 1, 10, 4, '2014-10-12' ),
( 3, 2, 12, 8, '2014-11-01' ),
( 4, 2, 3, 8, '2014-11-02' );
WITH RunningTotals as (
select StockID , Qty , price , total , total - qty AS PrevTotal, TranDate , rn FROM (
select
StockID, InQty AS QTY , Price
, SUM(InQty) over (PARTITION BY StockID order by tranDate , inQty DESC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as Total
,ROW_NUMBER() OVER (PARTITION BY StockID ORDER BY tranDate , inQty DESC ) as rn
,TranDate --,TranID, TxnType
from @StockIn ) A
) , TotalOut as (
SELECT StockID , Sum(OutQty) AS QTY , lineid -- Group by stockID of any lineidFROM @StockOut
GROUP BY StockID , lineid
) , GrandTotal as
select
rt.StockID , rt.QTY AS original ,SUM(CASE WHEN PrevTotal > isNULL(out.Qty, 0) THEN rt.Qty ELSE rt.Total - isNULL(out.Qty, 0) END) AS QTY , Price , SUM(CASE WHEN PrevTotal > isNULL(out.Qty, 0) THEN rt.Qty ELSE rt.Total - isNULL(out.Qty, 0) END * Price) AS Ending , rt.TranDate , lineid from
RunningTotals rt
left join
TotalOut out
on
rt.StockID = out.StockID
where rt.Total > isNull(out.Qty , 0)
group by rt.StockID , Price , rt.TranDate , rt.QTY , lineid
) Select * from GrandTotal order by stockID ----------------------------------------------How can i running the total out (OutQty*price) of any lineidCheck this query, the date is excluded because it cannot return the result you want with and it will not be of any value to read the date like that in such a query:
DECLARE @StockIn TABLE
InID INT ,
StockID INT ,
InQty DECIMAL(16, 2) ,
Price DECIMAL(16, 2) ,
tranDate DATE ,
running INT
DECLARE @StockOut TABLE
OutID INT ,
StockID INT ,
OutQty DECIMAL(16, 2) ,
lineid INT ,
tranDate DATE
INSERT INTO @StockIn ( InID, StockID, InQty, Price, tranDate, running )
VALUES ( 1, 1, 15, 430, '2014-10-09', 1 ),
( 2, 1, 10, 431, '2014-10-10', 2 ),
( 3, 1, 15, 432, '2015-02-02', 3 ),
( 4, 2, 15, 450, '2014-08-05', 1 ),
( 5, 2, 6, 450, '2014-10-01', 2 ),
( 6, 2, 15, 452, '2015-10-02', 3 )
INSERT INTO @StockOut ( OutID, StockID, OutQty, lineid, tranDate )
VALUES ( 1, 1, 20, 2, '2014-10-11' ),
( 2, 1, 10, 4, '2014-10-12' ),
( 3, 2, 12, 8, '2014-11-01' ),
( 4, 2, 3, 8, '2014-11-02' );
WITH RunningTotals as (
select StockID , Qty , price , total , total - qty AS PrevTotal, TranDate , rn FROM (
select
StockID, InQty AS QTY , Price
, SUM(InQty) over (PARTITION BY StockID order by tranDate , inQty DESC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as Total
,ROW_NUMBER() OVER (PARTITION BY StockID ORDER BY tranDate , inQty DESC ) as rn
,TranDate --,TranID, TxnType
from @StockIn ) A
) , TotalOut as (
SELECT StockID , Sum(OutQty) AS QTY , lineid -- Group by stockID of any lineid
FROM @StockOut
GROUP BY StockID , lineid
) , GrandTotal as
select
rt.StockID , rt.QTY AS original ,SUM(CASE WHEN PrevTotal > isNULL(out.Qty, 0) THEN rt.Qty ELSE rt.Total - isNULL(out.Qty, 0) END) AS QTY , Price , SUM(CASE WHEN PrevTotal > isNULL(out.Qty, 0) THEN rt.Qty ELSE rt.Total - isNULL(out.Qty, 0) END * Price) AS Ending , rt.TranDate , lineid from
RunningTotals rt
left join
TotalOut out
on
rt.StockID = out.StockID
where rt.Total > isNull(out.Qty , 0)
group by rt.StockID , Price , rt.TranDate , rt.QTY , lineid
) Select Distinct StockID,(select sum(original) from GrandTotal G where G.lineid = GrandTotal.lineid) as original,(select sum(QTY) from GrandTotal G where G.lineid = GrandTotal.lineid) as QTY,
(select sum(Price) from GrandTotal G where G.lineid = GrandTotal.lineid) as Price, (select sum(Ending) from GrandTotal G where G.lineid = GrandTotal.lineid) as Ending,lineid from GrandTotal
order by stockID
the result will be:
StockID original QTY Price Ending lineid
1 25.00 20.00 863.00 8635.0000 2
1 40.00 30.00 1293.00 12940.0000 4
2 21.00 21.00 902.00 9480.0000 8
Fouad Roumieh -
Can we join Ztables with SAP std. tables in SQVI ?
Dear All,
Can we join Ztables with SAP std. tables in SQVI ?
How to use "left outer join" in SQVI ?
What r the rules/steps to be followed for creating right SQVI/query ?
Sometimes it gives error / we do not get any output ....
Pl' give examples.hi
good
1- Yes
3-Check this example for SQVI Query.
It is possible to generate a complete list of purchase document releases with the purchase document number (requisitions and orders), releaser, release date and release time.
First, create an Infoset using transaction SQ02 directly reading from table CDPOS and create an additional table: CDHDR. If you are releasing purchase requsitions at the item level, it is convenient to create an additional field (PURPS LIKE EBAN-BNFPO) to capture the item number. Once the field is defined add the following code to it:
PURPS = CDPOS-TABKEY+14(5).
Once created, make sure to assign your Infoset to the user groups.
Second, create an SAP Query (SQ00) or QuickViewer (SQVI) based on the Infoset you created previously. Set CDPOS-OBJECTID, PURPS (additional field), CDHDR-USERNAME, CDHDR-UDATE & CDHDR-UTIME, CDPOS-TCODE, CDPOS-VALUE_NEW, and CDPOS-VALUE_OLD as list fields (display screen).
Set CDPOS-OBJECTCLAS, CDPOS-OBJECTID, CDPOS-TABNAME, CDPOS-FNAME, CDPOS-CHANGIND, CDHDR-USERNAME, CDHDR-UDATE & CDHDR-UTIME as the selection fields (selection screen).
Finally, execute your query. For filtering purchase requisition releases set:
Object class='BANF'
Table Name='EBAN'
Field Name='FRGKZ'
Change type='U'
For filtering purchase order releases set:
Object class='EINKBELEG'
Table Name='EKKO'
Field Name='FRGKE'
Change type='U'
Make sure to specify username, dates or purchase document number (object value) in order to reduce run times.
thanks
mrutyun^ -
Join table with additional data
Hi,
I'm new to JPA (Toplink Essentials) and I'd like to know how to handle this situation:
I have ORDER table, ITEMS table and "join table" ORDER_ITEMS which holds refernces to ordered items with quantity of each oredered item.
Many thanksI did mapping as shown in listing. It works for reading, but for writing JPA returns error. Can somebody help?
Thanks
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Column name 'idexpedice' appears more than once in the result column list.
Error Code: 264
Call: INSERT INTO vklad_expedice (IDEXPEDICE, IDVKLAD, VAHA, idexpedice, idvklad) VALUES (?, ?, ?, ?, ?)
bind => [null, null, 0, 4411, 2]
@Entity
public class Expedice implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer idexpedice;
@Temporal(TemporalType.DATE)
private Date datum;
@OneToMany(fetch = FetchType.EAGER, mappedBy="expedice", cascade = CascadeType.ALL)
private List<ExpediceVklad> vklady;
@Entity
public class Vklad implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer idvklad;
private String nazev;
@Entity
@Table(name = "vklad_expedice")
@IdClass(ExpediceVkladId.class)
public class ExpediceVklad implements Serializable {
@Id
private Integer idexpedice;
@Id
private Integer idvklad;
private Integer vaha;
@ManyToOne
@JoinColumn(name = "idexpedice")
private Expedice expedice;
@ManyToOne
@JoinColumn(name = "idvklad")
private Vklad vklad;
public class ExpediceVkladId {
@Id
private Integer idexpedice;
@Id
private Integer idvklad;
SQL tables
EXPEDICE
idexpedice
datum
VKLAD
idvklad
nazev
VKLAD_EXPEDICE (this is the join table with additional column)
idexpedice
idvklad
vaha
Edited by: user10933983 on 31.3.2009 13:47 -
Can't join tables.query dependency not found "" in EUL
hi ALL,
i created one report in disco 3.1.38 and its' running fine but after storing it in database and then again trying to open it from database it gives me error "can't join tables."name of query folder" dependency not found "" in EUL"
if any one has come across such problem and has solution for it ..please reply back.
thanks in anticipation
manishManish,
I have not run into this error before and maybe one of the oracle consultants could answer this better. But I here it goes. I would first try a refresh on the folders that the report in question is using. Is it possible that the under lining tables have changed? Do you have another copy of the same report outside of the database and does it still work?
Christopher -
Where can I found table or structure changes across different releases ?
Hi !
Just one question:
I would like to found where can I see tables or structures changes across differents releases of SAP R/3?, i tried to found a doc about this... but i couldn't found it.
For example, which table have been modify form version 4.x to 4.z, i mean fields added or modified, etc...
Thanks in advance,
Albio.-Hi Albio,
You can do this. You can check the activation log of any table which you have to find for change history.
Just go to se11 and type the table name click on display and then go to utilities -> then activation log, it will show you all the changes made to table
Regards
Sumit Bhutani
<b>Ps reward pts if helpful</b> -
How can i build table with two user name columne ?
How can I build view with two columns for user name ( one create and the other
Can change also )
And to display full name ( the user name is the key but not display ) ?Hi,
Creating View
From initial screen of data dictionary(T.Code: SE11), enter the name of object i.e. view.
Select view radio button and click on the push button.
Dialog box is displayed for types of views.
Select the view type.
On the next screen, you have to pass following parameters.
Short text
In the table box you need to enter the table names, which are to be related.
In join table box you need to join the two tables.
Click on the TABFIELD. System displays the dialog box for all the table fields and user can select the fields from this screen. These fields are displayed in the view fields box.
Save and Activate: When the view is activated, view is automatically created in the underlying database system. As long as the table exists in the database, the view also exists (Unless you delete it).
Regards,
Bhaskar -
[Function] Declare a internal table with structure name (entry parameter)
Hi all,
I'm explaining my problem :
I want to create a function with two parameters in entry :
(IMPORT) - structure_name with type DD02L-TABNAME
(TABLES) - t_outtab with empty type
t_outtab will be in structure_name type.
Now, in my source function, I want to retrieve all contain of t_outtab in another internal table or field-symbol. I don't know in advance the used structures in my function entries.
I don't manage to get this contain, cause I can't do :
DATA : internal_table TYPE structure_name*
OR
DATA : internal_table TYPE (structure_name)
OR used field-symbol
DATA : internal_table TYPE <fs>* where <fs> had structure name value.
To do more later :
*DATA : line LIKE LINE OF internal_table. *
*internal_table][ = t_outtab][. *
And work with this table.
_ I tried different solutions like : _
Get the structure of the table.
ref_table_des ?= cl_abap_typedescr=>describe_by_name( I_STRUCTURE_NAME ).
idetails[] = ref_table_des->components[].
Get the first structure table of result table
LOOP AT idetails INTO xdetails.
CLEAR: xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
xfc-inttype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
APPEND xfc TO ifc.
ENDLOOP.
Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ifc
IMPORTING
ep_table = dy_table.
ASSIGN dy_table->* TO <dyn_table>.
Create dynamic work area and assign to FS
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
and retrieve to <dyn_table>[] = t_outtab[].
the but I don't try the solution. If someone have an idea.
Thanks and regards.
Romain
Edited by: Romain L on May 14, 2009 11:35 AMHi,
We can acheive this using dynamic internal tables.
Please find sample below.
*Creating Dynamic internal table
PARAMETERS : p_table(10) TYPE C.
DATA: w_tabname TYPE w_tabname,
w_dref TYPE REF TO data,
w_grid TYPE REF TO cl_gui_alv_grid.
FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE.
w_tabname = p_table.
CREATE DATA w_dref TYPE TABLE OF (w_tabname).
ASSIGN w_dref->* TO <t_itab>.
* Populating Dynamic internal table
SELECT *
FROM (w_tabname) UP TO 20 ROWS
INTO TABLE <t_itab>.
* Displaying dynamic internal table using Grid.
CREATE OBJECT w_grid
EXPORTING i_parent = cl_gui_container=>screen0.
CALL METHOD w_grid->set_table_for_first_display
EXPORTING
i_structure_name = w_tabname
CHANGING
it_outtab = <t_itab>.
CALL SCREEN 100.
* Scenario 2:
*Create a dynamic internal table with the specified number of columns.
* Creating Dynamic internal table
TYPE-POOLS: slis.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE, u201C Dynamic internal table name
<fs_dyntable>, u201C Field symbol to create work area
<fs_fldval> type any. u201C Field symbol to assign values
PARAMETERS: p_cols(5) TYPE c. u201C Input number of columns
DATA: t_newtable TYPE REF TO data,
t_newline TYPE REF TO data,
t_fldcat TYPE slis_t_fldcat_alv,
t_fldcat TYPE lvc_t_fcat,
wa_it_fldcat TYPE lvc_s_fcat,
wa_colno(2) TYPE n,
wa_flname(5) TYPE c.
* Create fields .
DO p_cols TIMES.
CLEAR wa_it_fldcat.
move sy-index to wa_colno.
concatenate 'COL'
wa_colno
into wa_flname.
wa_it_fldcat-fieldname = wa_flname.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 10.
APPEND wa_it_fldcat TO t_fldcat.
ENDDO.
* Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fldcat
IMPORTING
ep_table = t_newtable.
ASSIGN t_newtable->* TO <t_dyntable>.
* Create dynamic work area and assign to FS
CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
ASSIGN t_newline->* TO <fs_dyntable>.
*Populating Dynamic internal table
DATA: fieldname(20) TYPE c.
DATA: fieldvalue(10) TYPE c.
DATA: index(3) TYPE c.
DO p_cols TIMES.
index = sy-index.
MOVE sy-index TO wa_colno.
CONCATENATE 'COL'
wa_colno
INTO wa_flname.
* Set up fieldvalue
CONCATENATE 'VALUE' index INTO
fieldvalue.
CONDENSE fieldvalue NO-GAPS.
ASSIGN COMPONENT wa_flname
OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = fieldvalue.
ENDDO.
* Append to the dynamic internal table
APPEND <fs_dyntable> TO <t_dyntable>.
* Displaying dynamic internal table using Grid.
DATA: wa_cat LIKE LINE OF fs_fldcat.
DO p_cols TIMES.
CLEAR wa_cat.
MOVE sy-index TO wa_colno.
CONCATENATE 'COL'
wa_colno
INTO wa_flname.
wa_cat-fieldname = wa_flname.
wa_cat-seltext_s = wa_flname.
wa_cat-outputlen = '10'.
APPEND wa_cat TO fs_fldcat.
ENDDO.
* Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = fs_fldcat
TABLES
t_outtab = <t_dyntable>.
Thanks,
Jyothi
Edited by: Jyothi on May 14, 2009 11:42 AM
Edited by: Jyothi on May 14, 2009 11:43 AM -
Hi,
I make query as belown to join PO with GRPO.I wnat to calculate Quantity from PO to GRPO but in my query it show duplicate record i also use distinct but useless.My query as below.
SELECT T1.DocNum [PO No], T1.DocDate [PO Date], T3.ItemCode, T3.Dscription, T3.U_CostCentre, T3.DocEntry [GRN No], T0.DocDate [GRN Date],T3.Quantity'GRIR Quantity',T2.Quantity 'PO Quantity',
T3.Quantity-T2.Quantity 'Balance Quantity'
FROM OPDN T0 , OPOR T1, POR1 T2, PDN1 T3
WHERE T1.DocEntry = T2.DocEntry
and T0.Docnum = T3.Docentry
and T3.BaseRef = T1.DocNum
and T2.ItemCode = T3.ItemCode
and T3.DocDate between [%0] and [%1]
Can any body help in this regards.
Sohail Anwar AliHi Sohail,
As i understand, you want to know till now how much of quantity stills needs to be delivered, in that case instead of trying joining two tables i would suggest to try this query which gives you
Purchase Order Document No,
Purchase Order Date,
Vendor Name,
Item Code,
Item Description,
Ordered Quantity,
Received Quantity,
Open Quantity.
as the filed OpenQty stores the Quantity yet to receive for that particular Purchase Order. As this approach is much more flexible
Query
SELECT T0.DocNum, T0.DocDate, T0.CardName, T1.ItemCode, T1.Dscription, T1.Quantity,
(T1.Quantity-T1.OpenQty) as "Recevied Quantity",
T1.OpenQty FROM OPOR T0 INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.DocDate >=[%0] and
T0.DocDate <=[%1]
I hope this helps out your issue
regards,
Shreyas -
How can I join PRPS with DRAD?
Hi,
I would like to join the table PRPS and DRAD in order to see all documents linked to a certain PSP. I tried to join DRADOBJKY with PRPSPSPNR but it doesn't work since the OBJKY is different from the psp-number. If I'm doing this with MARA~MATNR it works. Strange. can someboy help me?
ThanksHello,
Can you check if PRPS-OBJNR = DRAD-OBJKY ?
If this is not successful, then use the conv. exit CONVERSION_EXIT_ABPSP_INPUT, pass the PRPS-OBJNR get the internal number.
Now check that this internal number matches with DRAD-OBJKY.
Plz revert back.
BR,
Suhas -
Joining tables with SQL in Crystal XI
I am new to Crsytal Reports. I want to join 2 tables using a formula, which I am trying to do in SQL. I created a simple test report and I can get it to work if I don't put any fields on the report from the joined table. ie - if I just use fields from "sal-rep" the report works. As soon as I add a field from "freight" (my joined table) the report will not display anything. (but I don't get any error messages - just a blank report). Here is my SQL:
SELECT "sal-rep"."full-name","sal-rep"."invoice-nbr","freight"."misc-charge-ammount" FROM "PUB"."sal-rep" INNER JOIN "PUB"."FREIGHT" ON ("sal-rep"."invoice-nbr"="freight"."invoice-nbr") WHERE "sal-rep"."invoice-nbr"='0000189957'I got it to work!!! This is the SQL I used -
SELECT "sal_rep"."full-name", "sal_rep"."invoice-nbr", "freight"."misc-charge-ammount", "freight"."invoice-date"
FROM "PUB"."freight" "freight" INNER JOIN "PUB"."sal-rep" "sal_rep" ON ("freight"."invoice-nbr"="sal_rep"."invoice-nbr") AND ("freight"."invoice-date"="sal_rep"."inv-date")
WHERE "sal_rep"."invoice-nbr"='0000189957'
Now when I look at the Table used in Database expert it lists - Command and Freight.
Before it was listing Command and Sal-Rep.
Not sure I understand why, but at least it's working.
thanks for your help - really appreciated! -
Join table with an object type
Hi,
I would like ot know how to join a table with another table having an object type as a column value.
For ex:
Create type add_obj as object (st varchar2(10), city varchar2(10), zip varchar2(10));
Table A
Cust_id number
cust_address add_obj
Table B
Cust_id number
order_id number
I want to select the complete address for each order.
Is this the correct way to do this select:
Select o.order_id, c.customer_id, c.cust_address.st, c.cust_address.city, c.cust_address.zip
from table A c, table B o;
Any leads is appreciated. Thanks in advance.>
unfortunately with a crashed Oracle db I could try nothing.... Forums are for getting help and offering help in times of need.
Will take your advice some other time. Now need help on how to select the address city, st and zip along with the order_id.
>
Ah - I understand - you mean before your class is over.
Unfortunately with a crashed Oracle db you will not know if our advice is correct or not since you won't be able to test it.
So I will offer advice some other time. Now need to get some fresh air and a hot cup of coffee.
Let us know when you DB is back up and you have run your tests. Then if you still have any questions other forum members may decide to help you. Well - if their database is up and running that is. -
Many to many join table with different column names
Hi have a joint table with different column names as foreign keys in the joining
tables...
e.g. i have a many to many reltnshp btwn Table A and Table B ..and join table
C
both have a column called pk.
and the join table C has columns call fk1 and fk2
does cmd require the same column name in the join table as in the joining table?
are there any workarounds?
thanksHI,
No, the foreign key column names in the join table do not have to match the primary
key names in the joined tables.
-thorick -
Updating parent row in a self-join table with triggers
Hi Gurus!
Need of a business to update parent row(s) in the same table with triggers (insert, update and delete). Table is having recursive relation and error is coming as mutating error. I was able to do this with MS-SQL server.
Appreciate any help or work around possibilities.
Regards,
SHSH,
popular solutions to this issue include
- autonomous transactions
- recording (typically in PL/SQL package variables) the rows being processed from the row level triggers and using this information in the after statement level trigger to perform the update on the parent rows
- use a View with an instead of trigger to re-route the DML on your table
Which one to use depends on what exactly you are trying to achieve and how the data hangs together.
Lucas -
Query 4 joined tables with internal joins to represent a complex hierarchy!
I've got to refine/replace a query (Oracle 9i) that
currently joins rows from four tables in a hierarchical
fashion that I use to produce a listing like this:
agency abc 1
....division def 1.1
........service ghi 1.1.1
........service jkl 1.1.2
............faq mno 1.1.2.1
............faq pqr 1.1.2.2
........service stu 1.1.3
....division vwx 1.2
........service yyy 1.2.1
............faq zzz 1.2.1.1
The change involves allowing for unlimited levels of
nested child divisions to produce a listing like this:
agency abc 1
....division def 1.1
........service ghi 1.1.1
........service jkl 1.1.2
............faq mno 1.1.2.1
............faq pqr 1.1.2.2
........service stu 1.1.3
....division vwx 1.2
........division xxx 1.2.1
............division aaa 1.2.1.1
............division bbb 1.2.1.2
................service aaa 1.2.1.2.1
....................faq fff 1.2.1.2.1.1
....................faq ggg 1.2.1.2.1.2
........service yyy 1.2.1
............faq zzz 1.2.1.1
Notice the insertion of three nested divisions under
division 1.2 with services and faqs under those. The
order of names throughout is alphabetic within a nesting
level.
Here's the SQL I currently use, without nested divisions
(it contains extra info that I use to control what and
how names are displayed):
SELECT
agency.agency_id AGENCY_ID,
agency.agency_type_id AGENCY_TYPE_ID,
agency.name AGENCY_NAME,
agency.acronym AGENCY_ACRONYM,
agency.expiration_date AGENCY_EXP,
agency.post_count AGENCY_POST,
agency.stat AGENCY_STAT,
agency_type.agency_type AGENCY_TYPE,
division.division_id DIV_ID,
division.name DIV_NAME,
division.transfer_number DIV_TRANS_NUM,
division.expiration_date DIV_EXP,
division.post_count DIV_POST,
division.stat DIV_STAT,
service.service_id SVC_ID,
service.name SVC_NAME,
service.taxonomy SVC_TAX,
service.keywords SVC_KEYWORDS,
service.action_type SVC_ACTION_TYPE,
service.sr_form_name SVC_SR_FORM,
service.expiration_date SVC_EXP,
service.post_count SVC_POST,
service.stat SVC_STAT,
faq.faq_id FAQ_ID,
faq.name FAQ_NAME,
faq.expiration_date FAQ_EXP,
faq.post_count FAQ_POST,
faq.stat FAQ_STAT
FROM
agency,
agency_type,
division left join service on
division.division_id=service.division_id left join
faq on service.service_id=faq.service_id
WHERE (
(agency_type.agency_type_id = agency.agency_type_id)
AND (agency.agency_id = division.agency_id)
AND (agency.agency_id = :agency_id )
It's very fast -- I can retrieve and display 5,000 rows
in seconds using Perl DBI and CGI -- and very easy to use
to produce the hierarchical listing of items from the
four tables. It is also very straightforward since I was
able to generate the SQL using the SQL modeler in TOAD
(I'm not the strongest SQL developer so I resort to
tools).
I need to get jump-started in the right direction to
determine what I need to add to my division table
(div_parent_id?), if I need a div_parent_child table to
define the relationships (rows with parent_id & child_id
pairs), and how to change or rewrite the SQL query. The
CGI form that will be used to define the relationships
will ask users to define children of a given division. I
envision presenting a list of divisions with null
parent_division_id columns for users to select from then
updating selected rows for selected divsions.
Thanks in advance for any help/guidance!
-GeneINLINE VIEWS!
select whatever_you_want
from (
SELECT FOLDER_ID, PARENT_FOLDER_ID, FOLDER_NAME
FROM FOLDERS
START WITH PARENT_FOLDER_ID = 0 CONNECT BY PARENT_FOLDER_ID = PRIOR FOLDER_ID
) tree, FILES
where tree.folder_id = files.folder_id -- or something like that
always try to keep the CONNECT BY limited to ONE AND ONLY table. then use that query in a subquery, a WITH clause, an inline view or something. do not try to JOIN or UNION with a CONNECT BY. it won't work the way you think it will, and even it returns the expected results, it will perform terribly.
* your mileage may vary
Message was edited by:
shoblock
added exclamation marks to show my excitement!!!!
Maybe you are looking for
-
Hi All, I am calling a custom RFC inside Synchronous ABAP server proxy.The problem is that I am getting HTTP Response code not OK error in XI callAdapter Pipeline step when RFC is returning application error (Return type of RFC Message is E ). Error
-
How do you edit the template image that appears at the top only in portrait mode?
I am using a customized version of the iBooks Author template which has the space image. I have replaced the images for the book cover, chapter and section. But I noticed that when you rotate the ipad to view the entire TOC, the original space image
-
How can I get the information of current BW system id?
How can I get the information of current BW system id '0TCTSYSID' or 'LOGSYS'? thank your attention!
-
Best practices of Upgrade - 10.1.2 to 10.1.3
One of our customer is planning to upgrade BPM (BPEL Process manager server) to latest version-(10.1.2 to 10.1.3) Please let me know if someone has any best practice document on this upgrade and provide some guidance to modify the old components to n
-
How do I add Security Devices during Firefox deployment?
I recently found a method to at PKI CAC support to FF, but this is a manual method that would need to be done to each system. Is there a way to deploy a security device that could replicate this process?