Reference of a column of one query in another..
Hi Guys,
I have two queries on data model of my report. Q1 and Q2, both these queries have columns of dates
Q1 has Hire_Date column and
Q2 has Increment_Date
I want to restrict records of Q2 query , it only bring records where Increment_Date < Hire_Date.
where clause will be "where increment_date < hire_date" but how to refrence the Hire_Date of Q1 in my query Q2.
Please Help!!!
Imran Baig
Hi,
Create data link between these 2 queries using columns
Hire_date,Increment_date.
Open Link properties, by selecting link and pressing F4.\
change where condition, there.
You did that.
Adinath Kamode
Similar Messages
-
LOCAL Structure to be copied from one query to another query
Hello all,
In our query we have created a structure locally....
we have to copy the same locally created structure from one query to another query which is on the same multiprovider.
We do not want to make the structure global.
Can anyone suggest some method to achieve this!For copiying structures fom query to another you have to do it global. After that you can do click on right button on the structure when added to your query and choose "eliminate reference" this does further changes in the structure were local for that query.
-
I can't import a table contains BLOB column from one user to another user.
1) I create two user both have connect role,and each has its own tablespace, DDL:
create user d2zd identified by d2zd default tablespace d2zd quota unlimited on d2zd account unlock;
grant connect to d2zd;
create user d3zd identified by d3zd default tablespace d3zd quota unlimited on d3zd account unlock;
grant connect to d3zd;
2)Then enter oracle as d2zd and create a table contains BLOB column and insert data to the table.
3) export d2zd as follow:
exp d2zd/d2zd file=d2zd.dmp
4) import to d3zd as follow:
imp d3zd/d3zd fromuser=d2zd touser=d3zd file=d2zd.dmp
the question is the table with BOLB colum can't be import,
it says:have no privilege on tablespace d2zd.
How can I import a table contains BLOB column from one user to another user?Hi - the reason for as our friend already told ist that a blob can be stored outside of the table segment, in another Tablespace, This is for performance reason.
Sou you would need to have Quota on two tablespaces.
the one which holds the table segment the other which holds the blob(segment).
Regards
Carl
Message was edited by:
kreitsch -
Move column from one place to another..
Hi
I need to arrange the order in which the columns are displayed in my ALV Grid displayed so that i can move the columns from one position to another but its not been allowed in the program so could u pls suggest which field needs to be set for this?
Regards
GunjanHi
You can use the following statement
ls_fcat-col_pos = 01.
By using this you can fix your column position
or else to sort the column try like this
sort-spos = '10'.
SORT-FIELDNAME = 'Years'.
SORT-TABNAME = 'DATA_TAB2'.
sort-UP = 'X'.
sort-subtot = 'X'.
SORT-GROUP = '* '.
APPEND SORT. CLEAR SORT.
In the It_SOET internal table write:
IT_SORT-Group = 'X'.
REPORT ZSDN .
TABLES : ekkn,ekko,EKPO,EKET,VBEP,LFA1.
TYPE-POOLS : slis, ICON.
DATA : DATE1 TYPE SY-DATUM.
data : begin of itab occurs 0,
VBELN like ekkn-VBELN, "SALE ORDER
VBELP LIKE EKKN-VBELP, "LINE ITEM
BEDAT LIKE EKKO-BEDAT, "DOCUMENT DATE
KUNNR LIKE VBAK-KUNNR, "SOLD TO PARTY
VBELN1 like VBEP-VBELN, "SALE ORDER1
POSNR1 LIKE VBEP-POSNR, "LINE ITEM
EDATU LIKE VBEP-EDATU, "END DATE
EMATN LIKE EKPO-EMATN, "STATUS
BMENG LIKE VBEP-BMENG, "DAYS
TDDAT LIKE VBEP-TDDAT, "START DATE
LMENG LIKE VBEP-LMENG, "DAYS -START DATE
LABNR LIKE EKPO-LABNR, "STATUS
PLNUM LIKE VBEP-PLNUM, "OVERALL STATUS
EKGRP like ekko-EKGRP, "PURCHASING GROUP
EBELN LIKE EKKN-EBELN, "PO NO
EBELP like ekkn-EBELP, "LINE ITEM
EINDT LIKE EKET-EINDT, "DELIVERY DATE
MATNR LIKE EKPO-MATNR, "MATERIAL NUMBER
TXZ01 LIKE EKPO-TXZ01, "MATERIAL TEXT
LIFNR LIKE EKKO-LIFNR, "VENDOR
MENGE LIKE EKPO-MENGE, "QUANTITY
WEMNG LIKE EKET-WEMNG, "GR QTY
WAMNG LIKE EKET-WAMNG, "BAL QTY
MEINS LIKE EKPO-MEINS, "OUn
NETPR LIKE EKPO-NETPR, "PRICE
LOEKZ LIKE EKPO-LOEKZ, "DELETED
LIFNR1 LIKE LFA1-LIFNR, "VENDOR
NAME1 LIKE LFA1-NAME1, "VENDOR NAME
WERKS LIKE EKPO-WERKS, "PLANT
end of itab.
DATA : BEGIN OF it_final OCCURS 0,
KUNNR LIKE VBAK-KUNNR, "SOLD TO PARTY
LABNR LIKE EKPO-LABNR, "STATUS
EMATN LIKE EKPO-EMATN, "STATUS
VBELN like ekkn-VBELN, "SALE ORDER
VBELP LIKE EKKN-VBELP, "LINE ITEM
BEDAT LIKE EKKO-BEDAT, "DOCUMENT DATE
EDATU LIKE VBEP-EDATU, "END DATE
TDDAT LIKE VBEP-TDDAT, "START DATE
PLNUM LIKE VBEP-PLNUM, "OVERALL STATUS
EKGRP like ekko-EKGRP, "PURCHASING GROUP
EBELN LIKE EKKN-EBELN, "PO NO
EBELP like ekkn-EBELP, "LINE ITEM
EINDT LIKE EKET-EINDT, "DELIVERY DATE
MATNR LIKE EKPO-MATNR, "MATERIAL NUMBER
TXZ01 LIKE EKPO-TXZ01, "MATERIAL TEXT
NAME1 LIKE LFA1-NAME1, "VENDOR NAME
MENGE LIKE EKPO-MENGE, "QUANTITY
WEMNG LIKE EKET-WEMNG, "GR QTY
WAMNG LIKE EKET-WAMNG, "BAL QTY
MEINS LIKE EKPO-MEINS, "OUn
NETPR LIKE EKPO-NETPR, "PRICE
WERKS LIKE EKPO-WERKS, "PLANT
END OF it_final.
DATA: color TYPE TABLE OF lvc_s_scol WITH HEADER LINE,
st_layout TYPE slis_layout_alv.
DATA : fcat TYPE slis_t_fieldcat_alv,
ls_fcat LIKE LINE OF fcat,
fheader TYPE TABLE OF slis_listheader WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0.
DATA :i_repid LIKE sy-repid,
gs_layout TYPE slis_layout_alv,
week type n.
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: zso FOR ekkn-vbeln.
SELECT-OPTIONS: zpgr FOR ekko-EKGRP.
SELECT-OPTIONS: ZPL FOR EKPO-WERKS.
SELECTION-SCREEN END OF BLOCK bk1.
gs_layout-colwidth_optimize = 'X'.
select A~VBELN
A~VBELP
A~EBELN
A~EBELP
B~MATNR
B~TXZ01
B~MENGE
B~MEINS
B~NETPR
B~WERKS
B~LOEKZ
C~EINDT
C~WEMNG
D~EKGRP
D~LIFNR
D~BEDAT
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM EKKN AS A
INNER JOIN EKPO AS B ON A~EBELN = B~EBELN
AND A~EBELP = B~EBELP
INNER JOIN EKET AS C ON A~EBELN = C~EBELN
AND A~EBELP = C~EBELP
INNER JOIN EKKO AS D ON A~EBELN = D~EBELN
WHERE A~VBELN IN ZSO
AND D~EKGRP IN ZPGR
AND B~WERKS IN ZPL.
LOOP AT ITAB.
ITAB-WAMNG = ITAB-MENGE - ITAB-WEMNG.
SELECT SINGLE VBELN KUNNR
FROM VBAK INTO (ITAB-VBELN , ITAB-KUNNR )
WHERE VBELN = ITAB-VBELN.
SELECT SINGLE VBELN EDATU
FROM VBEP INTO (ITAB-VBELN , ITAB-EDATU)
WHERE VBELN = ITAB-VBELN.
DATE1 = SY-DATUM.
ITAB-BMENG = ITAB-EDATU - DATE1.
if itab-BMENG < 0.
ITAB-EMATN = 'OVER DUE'.
elseif itab-BMENG ge 0 AND itab-BMENG le 10.
ITAB-EMATN = 'CRITICAL'.
elseif itab-BMENG > 10.
ITAB-EMATN = 'UNDER FOLLOW-UP'.
endif.
SELECT SINGLE VBELN POSNR TDDAT
FROM VBEP INTO (ITAB-VBELN1 , ITAB-POSNR1 , ITAB-TDDAT)
WHERE VBELN = ITAB-VBELN AND
POSNR = ITAB-VBELP.
ITAB-LMENG = ITAB-TDDAT - DATE1.
if itab-LMENG < 0.
ITAB-LABNR = 'OVER DUE'.
elseif itab-LMENG ge 0 AND itab-LMENG le 10.
ITAB-LABNR = 'CRITICAL'.
elseif itab-LMENG > 10.
ITAB-LABNR = 'UNDER FOLLOW-UP'.
endif.
IF ITAB-WAMNG LE 0 OR
ITAB-LOEKZ = 'L' OR
ITAB-LOEKZ = 'S'.
ITAB-PLNUM = 'CLOSED'.
ELSE.
ITAB-PLNUM = 'OPEN'.
ENDIF.
SELECT SINGLE LIFNR NAME1
FROM LFA1 INTO (ITAB-LIFNR1 , ITAB-NAME1)
WHERE LIFNR = ITAB-LIFNR.
MODIFY ITAB.
ENDLOOP.
loop at itab.
move-corresponding itab to it_final.
append it_final.
endloop.
perform edit_mask.
i_repid = sy-repid.
PERFORM fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = i_repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = fcat
i_save = 'A'
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form fieldcat
* text
* --> p1 text
* <-- p2 text
FORM fieldcat .
MOVE sy-repid TO i_repid.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-decimals_out = 2.
ls_fcat-col_pos = 1.
ls_fcat-fieldname = 'KUNNR'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'Sold to Party'.
ls_fcat-emphasize = 'C310'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 6.
ls_fcat-fieldname = 'LABNR'.
ls_fcat-outputlen = 20.
ls_fcat-seltext_m = 'Window Start Status'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C510'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 5.
ls_fcat-fieldname = 'EMATN'.
ls_fcat-outputlen = 15.
ls_fcat-seltext_m = 'Window End Status'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C410'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 2.
ls_fcat-fieldname = 'VBELN'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'Sale Order'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C710'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 3.
ls_fcat-fieldname = 'VBELP'.
ls_fcat-outputlen = 5.
ls_fcat-seltext_m = 'Item'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C710'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 4.
ls_fcat-fieldname = 'EBELN'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'PO Number'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C710'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 7.
ls_fcat-fieldname = 'EBELP'.
ls_fcat-outputlen = 5.
ls_fcat-seltext_m = 'PO Item'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 8.
ls_fcat-fieldname = 'EKGRP'.
ls_fcat-outputlen = 3.
ls_fcat-seltext_m = 'Pur.Group'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 9.
ls_fcat-fieldname = 'BEDAT'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'PO Doc.Date'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 10.
ls_fcat-fieldname = 'EINDT'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'PO Delivery Date'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 11.
ls_fcat-fieldname = 'MATNR'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'Material Number'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 12.
ls_fcat-fieldname = 'TXZ01'.
ls_fcat-outputlen = 15.
ls_fcat-seltext_m = 'Description'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 13.
ls_fcat-fieldname = 'NAME1'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'Vendor'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C110'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 14.
ls_fcat-fieldname = 'MENGE'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'PO Quantity'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 15.
ls_fcat-fieldname = 'WEMNG'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'Quantity Recvd'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 16.
ls_fcat-fieldname = 'WAMNG'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'Bal Qty'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 17.
ls_fcat-fieldname = 'MEINS'.
ls_fcat-outputlen = 2.
ls_fcat-seltext_m = 'OUn'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 18.
ls_fcat-fieldname = 'NETPR'.
ls_fcat-outputlen = 8.
ls_fcat-seltext_m = 'NetPrice'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 19.
ls_fcat-fieldname = 'TDDAT'.
ls_fcat-outputlen = 15.
ls_fcat-seltext_m = 'Window Start date'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 20.
ls_fcat-fieldname = 'EDATU'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'Window End date'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 21.
ls_fcat-fieldname = 'PLNUM'.
ls_fcat-outputlen = 10.
ls_fcat-seltext_m = 'PO Status'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C610'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ls_fcat-col_pos = 22.
ls_fcat-fieldname = 'WERKS'.
ls_fcat-outputlen = 5.
ls_fcat-seltext_m = 'Plant'.
ls_fcat-tabname = 'IT_FINAL'.
ls_fcat-emphasize = 'C210'.
APPEND ls_fcat TO fcat.
clear ls_fcat.
ENDFORM. " fieldcat
*& Form edit_mask
* text
* --> p1 text
* <-- p2 text
FORM edit_mask .
loop at it_final.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = it_final-vbeln
IMPORTING
OUTPUT = it_final-vbeln.
Read table it_final.
* modify it_final.
endloop.
ENDFORM. " edit_mask
Reward all helpfull answers
Regards
Pavan -
Drag a column from one position to another within the table.
Hello All,
In Web Dynpro Java, Is it possible to provide user a functionality with which he/she can move the columns of a table from one position to another ?
Scenario : Users want flexibility to decide the location the columns as per their convinience while they are working with the application.
So can we develop some code or can we use some UI element so that user is able to drag a column from one position to another within the table.
Regards
Mrinalini.Hi Mrinalini,
Yes this is possible you can try to move the table columns (Change the order). for this you don't need to do additional coding or property change its a default property for web Dynpro java tables.
Regards
Jeetendra -
Dear All,
I have to 2 queries. Using RRI (t-code RSBBS) I have linked both the queries to move from one query to another. In the first query I created a formula which puts a condition on a Keyfigure, in aggregation tab, Exception aggregation=total and gave the refernce char........
In my case formula "no of hrs < 24", total = exception aggr and refernce char= docket no". When I reproduce the report I get no of dockets as 38 because of the condition in the formula. I rightclick>goto the 2nd query using RRI. but here the report shows all docket nos, not restricted by the condition I gave in the formula in the first query. How can this restriction be carried from the 1st query to the 2nd?
Regards,
Jack Silverzhi,
In ur scenario 1st Query gives Header level information and 2nd Query will give the detail level information.
As per my understanding ur condition will work in 1st Query and in 2 it won't work because RRI's functionality.
Regards,
Edited by: ali basha on Jan 20, 2010 11:51 AM -
Drill through from one query to another query
Hi experts,
Anybody knows how to do drill through from one query to another query?
Any feedback will be really apreciated.
Thanks.The setting can be done in transaction RSBBS.
You only need to specify the sender and receiver query..
Ashish.. -
Find many-to-many relationship between two columns in one query
Hi All,
How can I run one query to determine if Column1 and Column2 in the following table have a many-to-many relationship?
Column1
Column2
Column3
b
x
s
b
x
t
c
x
s
c
y
s
c
y
t
Just by eyeballing it, we know there is, but in a real life situation, you cannot eyeball millions of records to make that decision.
I am using Access 2007. (SQL script that works with Access 2007 will be great, but script for SQL Server will be fine too.)
BI AnalystHi BI Analyst,
Take a look at this code:
IF OBJECT_ID('tempdb..#experiment') IS NOT NULL DROP TABLE #experiment;
CREATE TABLE #experiment (c1 CHAR(1), c2 CHAR(1), c3 CHAR(1))
INSERT INTO #experiment (c1,c2,c3) VALUES ('b','x','s'),('b','x','t'),('c','x','s'),('c','y','s'),('c','y','t')
SELECT c1, c2, c1+c2 AS bind,
COUNT(c1) OVER (PARTITION BY c1+c2) c1perbind,
COUNT(c2) OVER (PARTITION BY c1+c2) c2perbind,
COUNT(c1+c2) OVER (PARTITION BY c1) bindsperc1,
COUNT(c1+c2) OVER (PARTITION BY c2) bindsperc2
FROM #experiment
What your question asks is if there can be determined a many-to-many relationship. A many-to-many relationship is logical relation comprised of a pair of one-to-many relationships. The code above shows you which relational pairing occur in these one-to many
relationships. c1perbind (or c2) >1 indicates a one to many relation from that relational pairing, whereas the bindsperc1 indicates how many relations the individual c1 belongs to.
Now look at this code:
SELECT c1, c2, bind,
COUNT(c1) OVER (PARTITION BY c1+c2) c1perbind,
COUNT(c2) OVER (PARTITION BY c1+c2) c2perbind,
COUNT(bind) OVER (PARTITION BY c1) bindsperc1,
COUNT(bind) OVER (PARTITION BY c2) bindsperc2
FROM (SELECT DISTINCT c1, c2, c1+c2 AS bind FROM #experiment ) Q1
With the subquery reducing the set for the windows to operate on to distinct pairs the bindsperC1 and bindsperC2 will show count greater than one if they belong to a one-to-many relationship. When both are greater than 1 those rows are proof that the relationship
between C1 and C2 is a many-to-many.
If you're happy and you know it vote and mark. -
Update column in one table from another
I've got two tables:
t1:
con_num
con_code
ex
elin
addressee
a few other columns
t2:
con_num
con_code
elin
addressee
contact
a few other columns
I just got about 300 rows into t2 using sqlloader, and now I need to use t2 to update t1. t1 will have 3 rows per ex||elin, but t2 can have more or less rows per elin (which is the same as ex||elin in t1). If t2 has 4 rows per one elin, then that is 4 distinct pieces of data, and I need to make sure that t1 reflects 4 rows in its ex||elin, each containing the addressee||contact from t2. So I'll need to add a row to t1, as well as update 3 rows. Is this possible with just SQL, or do I need to write PL/SQL?
The following is the code I've been trying:
update t1
set t1.addressee =
(select addressee from t2
where t2.con_num = 'number'
and t1.con_code = t2.con_code
and t1.ex ||t1.elin_num = t2.elin_num)
This code is not correct, it returns more than one row from t2. Also, I'd need to concatenate contact onto addressee with a space in the middle, not just addressee, into t1.addressee.
Any ideas, pointers?
Thanks!Forgot some info: Ora8.1.5 on win2kpro. Also, I was wanting to combine addressee||contact in the insert/update statement to differentiate one addressee from another in t1 after the data is inserted. We can have several addressees that are the same, but each one goes to a different contact for each record.
Thanks! -
How to insert records with LONG RAW columns from one table to another
Does anybody know how to use subquery to insert records with columns of LONG RAW datatype from one table to another? Can I add a WHERE clause in the subquery statement? Thanks.
Insert into ... Select statements are not supported for long or long raw. You will have to either use PL/SQL or convert your long raw to blobs.
-
Insert columns of one array into another
how can one insert columns of an array into another array at every odd place of that array in which insertions are to be made? In short, columns of one array to be inserted into another array bt possibly in between the already initialised array.
Solved!
Go to Solution.here's an example, feel free to ask question if it's not clear for you.
hope it helps
When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
Attachments:
insert.vi 20 KB -
How to get last row and sum of all columns in one query
Hi ,
is there a way to get last record for a column and sum of all record for another column in the same query.
Best Regards ,You should define your requirements properly for volunteers to help here..
Your data is not good enough to provide you accurate solution. Reason being you dont have a proper column which differentiates between first and last entry.
The solution becomes easy based on your desgin.
I have introduced a grouping column called "id" and a time column called "time_of_insert" (only this way you can confidently say that you can differentiate between first and last (also a fool proof solution) --- you may optionally use sequence(instead of date though if you say you may end up inserting two rows at the same time, then probably sequence would be a better choice to differentiate rather than a timestamp field) etc...)
With your sample data something like this can be done to achieve your desired result.
WITH dataset AS
(SELECT 1 id,10 used, 8 remain,systimestamp+1/24 time_of_insert FROM DUAL
UNION ALL
SELECT 1 id, 1, 7,systimestamp+2/24 FROM DUAL
UNION ALL
SELECT 1 id,2, 5,systimestamp+3/24 FROM DUAL
UNION ALL
SELECT 1 id,1, 0,systimestamp+4/24 FROM DUAL
UNION ALL
SELECT 1 id,0, 0,systimestamp+5/24 FROM DUAL
UNION ALL
SELECT 1 id,1, 4,systimestamp+6/24 FROM DUAL)
SELECT *
FROM (SELECT SUM (used) OVER () sum_all,
FIRST_VALUE (remain)
OVER (PARTITION BY id ORDER BY time_of_insert DESC)
last_row
FROM dataset)
WHERE ROWNUM = 1;
Output:
SUM_ALL LAST_ROW
15 4
Cheers,
Manik. -
Needed help to add columns from one table to another table
Hi,
I have emp and dept tables. I think most of all might know what columns it's contain. Now I want to create table emp_dept with all emp and dept table columns.
I have wrote the below query it's worked too. But I think there should be some more other queries to get accomplish the same task. Plz let me know.
create table emp_dept as select a.*, b.dname, b.loc from emp a full outer join dept b on a.deptno = b.deptno where 1=2
Thanks for your time..Hi,
1004909 wrote:
Hi,
I have emp and dept tables. I think most of all might know what columns it's contain. Now I want to create table emp_dept with all emp and dept table columns.
I have wrote the below query it's worked too. But I think there should be some more other queries to get accomplish the same task. Why do you think that?
Plz let me know.
create table emp_dept as select a.*, b.dname, b.loc from emp a full outer join dept b on a.deptno = b.deptno where 1=2"WHERE 1 = 2" means you want to create the table, but not put any rows in it. In that case, theere's no need for a full outer join; a simple inner join would do just as well.
There is no single "right" or "best" table. (Most of us would have differerent jobs if there were.)
It does, however, make sense to talk about the "right" or "best" table for some specific purpose .
The emp and dept tables in the scott schema are great for transaction processing, where rows are frequenctly INSERTed, UPDATEd and/or DELETEd. For example, if department 10 moves from New York to Pune, you only have to find and UPDATE 1 row, and that one UPDATE will affect all employees in departemnt 10, regardess of how many there are.
What purpose will the emp_dept table have? Why is the table design used in the scott schema not best for you?
One possibility is that you need a tale that is very fast to query, even though it may be very inefficient for transactions. For example, you might want a data warehouse that is only refreshed once a day, and were you can run several common queries quickly, without joining the emp and dept tales.
Another possibility is that your data model (that is, what are the entities and the attributes) is different. For example, you may have a model where employees King and Miller both work in department 10, but King's location is New York, but Miller's is Pune.
In either of these situations, the table you posted migt be the best design. Why are you asking the question? What is the problem with the emp_dept table you posted? -
Move workflow status column from one library to another in Sharepoint 2010
Good morning,
I have two libraries in the same site, LibraryA and LibraryB.
On LibraryA, users upload documents upon which they start a collect signatures workflow. The view on LibraryA contains a column with the signatures workflow name showing status: ‘Compete’, ‘In progress’.
Now on LibraryA I have created a workflow to move any document one month after creation to LibraryB (using retention schedule) irrespective of signature workflow status.
Now what I would like is to have the signature workflow status shown in LibraryB as well. From what I understand you can add the workflow status column only on the library with which the workflow is associated. I also tried, on LibraryB, to create a new
column which Lookups in {Signature Approval History – Outcome} but this did not do the trick either.
Any workarounds?
Many ThanksHi,
According to your description, my understanding is that you want to move the workflow status column to another library in SharePoint 2010.
I recommend to use another column to get the value of the workflow status column and then move this column to another library.
We can use workflow to update the column with the value of workflow status column.
However, the workflow status column stores the value with numbers which represent different status, so we need to update the column with corresponding status based on the numbers in the workflow.
http://chanakyajayabalan.wordpress.com/2010/03/08/sharepoint-workflow-status-codes/
Best regards.
Thanks
Victoria Xia
TechNet Community Support -
Is there a way to reference a private variable from one class in another?
My first class starts off by declaring variables like so:
class tStudent {
// declare student name, id, grades 1 & 2, and gpa
private String fname, lname, g1, g2;
private int id;
private double gpa;
// define a constructor for a new student
tStudent () {fname=lname=g1=g2=null; id=-1; gpa=0.0;}
// define methods for manipulating the data members.
// readStudent: reads information for just one student
public void read (Scanner input) {
fname = input.next();
lname = input.next();
id = input.nextInt();
g1 = input.next();
g2 = input.next();
}And the second class:// tStudentList: for a list of students
class tStudentList {
private int nStudents;
private tStudent[] list;
// constructor for creating student list
tStudentList() {
list = new tStudent[36];
for (int i=0; i < 36; i++) list=new tStudent();
// read the individual students into the student list
public void read(Scanner scan) {
nStudents=0;
while (scan.hasNext()) {list[nStudents++].read(scan);}
// display the list of all students - fname, lname, id, g1, g2 and gpa
// with an appropriate header so the output matches my sample //output
public void print() {
Is there a way to reference the variables in the first class to use in the second? Specifically in the last section of code where I am going to print the list.Not without resorting to reflection hackery. If the fields are private (and are supposed to be), then that means "don't allow access to these to outsiders of this class" by design.
So if you really meant them to be accessible, then don't use private, or provide public accessors for them.
Maybe you are looking for
-
ITunes 11.1 issues in Windows 8 Pro 64bit
Hey there, just recognized some issues with iTunes 11.1 (which was needed to upgrade to iOS 7 on my 5). First of all the drag and drop option for dropping songs into iTunes and iTunes playlists from folders is missing. I had this a while ago with an
-
How do I refresh a table with a bind variable using a return listener?
JDev 11.1.2.1.0. I am trying to refresh a table with a bind variable after a record is added. The main page has a button which, on click, calls a task flow as an inline document. This popup task flow allows the user to insert a record. It has its own
-
Deleted tracks on Iphone are not deleted from the itunes playlist
When I delete some tracks on iphone, I would like them to be deleted from the itunes playlist as well when syncing. how can i do it? thanks
-
Cisco Security Manager 3.2.1 IEV
Hi All, I have run into a situation with the CSM 3.2.1. It is not showing any data on the IPS Event Viewer or the Real-Time Dashboard. Any help is appreciated. Thanks in advance.
-
Photos get cropped when printed
I have some images that I am sending to my local Walmart for printing. Walmart uses Fuji equipment. When I get the prints back I've noticed that some of the prints have been 'cropped'. A portion of the top or bottom is missing. This is most noticeabl