Multiple query, Embedded, Subquery? How to do this?
I'm still trying to learn PL/SQL and haven't gotten to PACKAGES, PROCEDURES, FUNCTIONS etc.
I've posted this in SPATIAL, but I think now it's more of just straight SQL query structure at this point.
It's a query of street locations. I need to take my STREET_NUM, STREET_DIR & STREET_NAME and get the X & Y coords from another table for that exact location. Then I need to do a BETWEEN on the values pulled and +/- 1800 of each X & Y. From that query I need the matching STREET_NUMs & STREET_NAMES from that same table. I then need to use all found street names and street numbers in a query that is used to pull all matching records that have an address that matches all the street names and street numbers.
That is one type of query that I would need. I have another thought on how to do this as well. We are looking for 1 block north & south of each address as well as 1 block east & west. If I were to take an address, say 3200 N. Main, and just do a 3200 +/- N, and then somehow find all the streets east & west of Main that fall within 1 block's distance. I guess this would give valid results, but which would be a simpler query or even doable?
Really need some help on this one. Thanx
Break it down into conditions first
select X_coord, Y_coord
from My_Coord_tab A, My_Street_Tab B
where A.street_num = B.street_num
and A.street_dir = B.street_dir
and A.street_name = B.street_name
select x_coord, y_coord
from My_Coord_Tab A, My_Coord_Tab b
where A.x_coord between (X_Coord from above query - 1800)
and (X_Coord from above quyer + 1800)
and B.y_coord between (Y_Coord from above query - 1800)
and (Y_Coord from above quyer + 1800)
Select Street_Num, Street_Name
from My_Coord_Tab A
where a.X_Coord = X_Coord (from second query above)
and a.Y_Coord = Y_Coord (from second query above)
They you should be able to use them as subqueries
select street_num, street_name
from my_coord_tab A,
( second query
from ... , (first_query) B
) C
where a.X_Coord = X_Coord (from second query above)
and a.Y_Coord = Y_Coord (from second query above)
Similar Messages
-
Help with aging query. not sure how to acomplish this???
Guys im a bit stuck usually i have a slight idea how to even start my query but for this particular one I just dont even know where to start to tackle
i have a table like so.
create table TRRACCD (
TRRACCD_GRNT_CODE varchar2(6),
TRRACCD_TRANS_dATE date,
TRRACCD_AMOUNT number(17,2),
trraccd_detail_code varchar2(6))with data like so
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('15-FEB-10', 'DD-MM-RR'),19764.77,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('12-MAR-10', 'DD-MM-RR'),2054.29,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('20-APR-10', 'DD-MM-RR'),4111.46,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('14-MAY-10', 'DD-MM-RR'),2570.1,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('10-JUN-10', 'DD-MM-RR'),2176.16,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('12-JUL-10', 'DD-MM-RR'),4756.29,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('13-AUG-10', 'DD-MM-RR'),28500.62,'GCSH');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('16-AUG-10', 'DD-MM-RR'),3602.3,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('17-SEP-10', 'DD-MM-RR'),3995.79,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('11-OCT-10', 'DD-MM-RR'),3413.6,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('11-NOV-10', 'DD-MM-RR'),2119.86,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('10-DEC-10', 'DD-MM-RR'),5905.52,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('10-DEC-10', 'DD-MM-RR'),12008.21,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('11-JAN-11', 'DD-MM-RR'),-10574.05,'GBIL');
INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('11-JAN-11', 'DD-MM-RR'),20241.9,'GBIL');however what i need to do is end up with an aging for the items summarize so the expected output should be something like
tbrraccd_grnt_Code 30-60 60-90 over90
400364 20,241.90 2119.86 7,370.09
if your confused about how i arrived at the 7370.90 is because i have to subtract entries with GCSH on them and i also need to take
entries that are - and applied them to the oldest period if the balance of the period is positive. im inclined to say that i can do this with sql but the only other way i can think of is using plsql?... any suggestions or solutions would be greatly appreciated.
the closest that i have gotten to acomplishing this query without pl is this. i know is lame but i need help.
SELECT TRRACCD_GRNT_CODE,
TRRACCD_TRANS_dATE,
TRRACCD_AMOUNT,
trraccd_detail_code,
round(sysdate - TRRACCD_TRANS_dATE) "total days"
--sum(case when round(sysdate - TRRACCD_TRANS_dATE)>190 then "greater then 190"end )
FROM TRRACCD
where trraccd_grnt_Code = '400364'
ORDER BY TRRACCD_GRNT_CODE,
TRRACCD_TRANS_dATE,
trraccd_detail_code;Hi, Miguel,
I should have mentioned this before: I'm assuming SYSDATE is some point on January 22, 2011, after 00:00. I don't think this has caused any confusion so far, but if the discussion continues for a day or two, let's be clear about that.
I think I see what you want regarding the rows where trraccd+detailcode='GSCH'. If we completly ignored all the GSCH rows, we would get this output:
TRRACC 0-29 30-59 60-89 90-over
400364 ...
400404 19904.97 6625.27 4757.01 67618.68You want GSCH amounts to cancel other amounts in the last column only until that column reaches 0 ; the remaining GSCH amount will cancel amounts in to "60-89" column, again, only until that amount reaches 0 . If there is anything left over, it will cancel amounts in the "30-59" column, and if there is still some left over, the "0-29" column.
To be specific, trraccd_grnt_code=400404 has a total of 72475.69 from GSCH rows. That counts against the "90-over" total.
67618.68 - 72475.69 = -4757.01; you want to dispaly 0 in the "90-over" column, and apply the remaining 4757.01 to the next column to the left.
That column contains 4757.01, which happens to be the exact maount left over from the previous subtraction, so you want to diesplay 0 in the "60-89" column.
The remaining columns to the left should contain their regular totals.
Here's one way to do that:
WITH got_col_num AS
SELECT trraccd_grnt_code
, CASE
WHEN trraccd_detail_code != 'GCSH' THEN trraccd_amount
END AS net_amount
, SUM ( CASE
WHEN trraccd_detail_code = 'GCSH' THEN trraccd_amount
END
) OVER (PARTITION BY trraccd_grnt_code)
AS gsch_total
, CASE
WHEN trraccd_amount < 0 THEN 4
WHEN trraccd_trans_date > SYSDATE - 30 THEN 1
WHEN trraccd_trans_date > SYSDATE - 60 THEN 2
WHEN trraccd_trans_date > SYSDATE - 90 THEN 3
ELSE 4
END AS col_num
FROM trraccd
WHERE trraccd_trans_date <= SYSDATE
, got_sum AS
SELECT trraccd_grnt_code
, col_num
, LEAST ( SUM (net_amount)
, GREATEST ( 0
, SUM (SUM (net_amount)) OVER ( PARTITION BY trraccd_grnt_code
ORDER BY col_num DESC
- gsch_total
) AS total
FROM got_col_num
GROUP BY trraccd_grnt_code
, col_num
, gsch_total
SELECT trraccd_grnt_code
, SUM (CASE WHEN col_num = 1 THEN total END) AS "0-29"
, SUM (CASE WHEN col_num = 2 THEN total END) AS "30-59"
, SUM (CASE WHEN col_num = 3 THEN total END) AS "60-89"
, SUM (CASE WHEN col_num = 4 THEN total END) AS "90-over"
FROM got_sum
GROUP BY trraccd_grnt_code
ORDER BY trraccd_grnt_code
;Whenever you want to understand a query like this, run just the first sub-query (in this case, got_col_num) and make sure you understand what it's doing. When you do, add one more sub-query, and make sure you understand what it's doing.
Add morte columns to the display to help you understand it better. For example, when you get to the point where you're trying to understand the 2nd sub-query above, got_sum, you might run this query:
WITH got_col_num AS
SELECT trraccd_grnt_code
, CASE
WHEN trraccd_detail_code != 'GCSH' THEN trraccd_amount
END AS net_amount
, SUM ( CASE
WHEN trraccd_detail_code = 'GCSH' THEN trraccd_amount
END
) OVER (PARTITION BY trraccd_grnt_code)
AS gsch_total
, CASE
WHEN trraccd_amount < 0 THEN 4
WHEN trraccd_trans_date > SYSDATE - 30 THEN 1
WHEN trraccd_trans_date > SYSDATE - 60 THEN 2
WHEN trraccd_trans_date > SYSDATE - 90 THEN 3
ELSE 4
END AS col_num
FROM trraccd
WHERE trraccd_trans_date <= SYSDATE
, got_sum AS
SELECT trraccd_grnt_code
, col_num
, gsch_total
, SUM (net_amount) AS period_sum
, SUM (SUM (net_amount)) OVER ( PARTITION BY trraccd_grnt_code
ORDER BY col_num DESC
) AS running_sum
, LEAST ( SUM (net_amount)
, GREATEST ( 0
, SUM (SUM (net_amount)) OVER ( PARTITION BY trraccd_grnt_code
ORDER BY col_num DESC
- gsch_total
) AS total
FROM got_col_num
GROUP BY trraccd_grnt_code
, col_num
, gsch_total
SELECT *
FROM got_sum
ORDER BY trraccd_grnt_code
, col_num
;which produces this output:
TRRACC COL_NUM GSCH_TOTAL PERIOD_SUM RUNNING_SUM TOTAL
400364 1 28500.62 20241.9 76146.2 20241.9
400364 2 28500.62 17913.73 55904.3 17913.73
400364 3 28500.62 2119.86 37990.57 2119.86
400364 4 28500.62 35870.71 35870.71 7370.09
400404 1 72475.69 19904.97 99005.93 19904.97
400404 2 72475.69 6625.27 79100.96 6625.27
400404 3 72475.69 4857.01 72475.69 0
400404 4 72475.69 67618.68 67618.68 0The total column in that sub-query is very complicated, so break it down some. You can see that it is based on an analytic SUM whose argumenet is an aggregate SUM, all wrapped in LEAST and GREATEST. That can be very hard to underrstand, so break it down. Display the aggregate SUM by itself (period_sum) and also display the analytic SUM, without the GREATEST and LEAST.
mlov83 wrote:
where can i get more information about these types of querys?Can you be more specific? What types of queries do you mean? Complicated queries? Pivots? GROUP BY?
... I'm always leary of using a solution that i dont understand Excellent reaction!
would you mind expalining it to me a little.Again, could you be more specific? I don't mind explaining things to you, but I don't want to explain parts you already understand. If something is new, you'll want to read the SQL Language manual, or other sources, anyway, so it's more efficient to do that first, and then post specific questions on this forum.
An example of a more specific question is: "When I looked up "WITH clause" in the SQL Language reference, I found this page:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#sthref9758
but I don't understand where it says ...
The query above says ... Is that what the manual is talking about when it says ...?"
Another example of a good question is
"The query you posted says ... I don't understand what that's doing. I looked for ... and ... but that didn't seem to have anything to do with this query. What should I look for?
The Oracle 10 SQL Language manual is indexed pretty poorly. If you can't find something, it may not be your fault. -
Multiple equility with subquery
The following query gives error, I thought I can match multiple columns with subquery, how can I achive this problem?
select * from answers where (survey_seq_id, main_group_id, sub_group_id) in
(select survey_seq_id, main_group_id, sub_group_id from surveys s join answers a on s.survey_id = a.survey_seq_id
where s.qa = 2 and a.main_group_id = 62
group by survey_seq_id, sub_group_id having sum(decode(answer, 'Yes', 1, 0)) != 1);
ORA-00979: bir GROUP BY ifadesi değil
00979. 00000 - "not a GROUP BY expression"
*Cause:
*Action:
Error at Line: 12 Column: 27thanks a lot.First step lets format your query nicely
select *
from answers
where (
survey_seq_id
, main_group_id
, sub_group_id
) in
select survey_seq_id
, main_group_id
, sub_group_id
from surveys s
join answers a
on s.survey_id = a.survey_seq_id
where s.qa = 2
and a.main_group_id = 62
group
by survey_seq_id
, sub_group_id
having sum(decode(answer, 'Yes', 1, 0)) != 1
Now if you see the query inside IN there are 3 columns in SELECT list and only 2 in GROUP BY list. And your error clearly says +00979. 00000 - "not a GROUP BY expression"+
main_group_id in the SELECT list is not used in the GROUP BY list
And to add further your query can be simplified as
select *
from (
select a.*
, sum(decode(answer, 'Yes', 1, 0)) over(partition by survey_seq_id, main_group_id, sub_group_id) sum_val
from answers a
join surveys s
on s.survey_id = a.survey_seq_id
where s.qa = 2
and a.main_group_id = 62
where sum_val != 1;Edited by: Karthick_Arp on Feb 11, 2013 3:05 AM
Added SQL With analytic function
Edited by: Karthick_Arp on Feb 11, 2013 3:28 AM
I missed surveys table in the query :( -
How to make & edit multiple query report
hi,
how to make multiple query report & i have an existing multiple query report when i edit it all the structure gets disturbed whenever i want to add or delete any column from an query.
how to do this ?
txsPerhaps you have "Flex Mode" selected in the Layout Editor? It's the button next to the padlock button.
Message was edited by:
Dave Hemming
Also PS: Vaguest. Question. Ever. -
In this report i have marked one line..if this width < 30,i need to multiply by a number 0.3 and if the width >=30,it multiplies by 0.37...how to use this logic here..??? anyone can help??
Declare @FromDate Datetime
Declare @ToDate Datetime
Declare @SCCode nvarchar(30)
select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
--Rcpt from PRDN (Condition checked for Return component exclusion also)
SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
T2.DocNum AS 'WorkOrderNo',
b.DocNum as 'Issue Doc No',
ISNULL(d.DocNum,'') as 'Receipt Doc No',
b.U_IssPSCName as 'SubContractor Name',
T2.ItemCode as 'FG Item Code',
T3.ItemName as 'FG Item Name',
T2.PlannedQty as 'FG Planned Qty',
T2.U_OD as 'OD',
T2.U_ID as 'ID',
T2.U_OD/25.4 as 'Inches',
(T2.U_OD-T2.U_ID)/2 as 'Width',
0 as 'FG Pending Qty',
0 as 'FG Receipt Qty',
'' as 'Issue Item Code',
'' as 'Issue Item Name',
Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
0 as 'Issue Item - Return Quantity',
'' as 'Return Doc No',
SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode not in (a.ItemCode)
LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode INNER JOIN OIGN d on c.DocEntry = d.DocEntry
WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID, T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2
UNION ALL
SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
T2.DocNum AS 'WorkOrderNo',
b.DocNum as 'Issue Doc No',
ISNULL(d.DocNum,'') as 'Receipt Doc No',
b.U_IssPSCName as 'SubContractor Name',
T2.ItemCode as 'Item Code',
T3.ItemName as 'Item Name',
T2.PlannedQty as 'Planned Qty',
T2.U_OD as 'OD',
T2.U_ID as 'ID',
T2.U_OD/25.4 as 'Inches',
(T2.U_OD-T2.U_ID)/2 as 'Width',
(Select (T2.PlannedQty - (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum))) as 'Pending Qty',
(Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum) as 'Receipt Qty',
a.ItemCode as 'Issued Item Code',
a.Dscription as 'Issued Item Name',
Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
(Select (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode))) as 'Issue Item - Return Quantity',
(ISNULL((Select (Select a2.DocNum from OIGN a2 where a2.DocEntry = a1.DocEntry) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode)),'')) as 'Return Doc No',
SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode in (a.ItemCode)
LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode LEFT JOIN OIGN d on c.DocEntry = d.DocEntry
WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID,T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2,a.ItemCode,a.Dscription order by T2.DocNum descHi,
Try this:
Declare @FromDate Datetime
Declare @ToDate Datetime
Declare @SCCode nvarchar(30)
select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
--Rcpt from PRDN (Condition checked for Return component exclusion also)
SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
T2.DocNum AS 'WorkOrderNo',
b.DocNum as 'Issue Doc No',
ISNULL(d.DocNum,'') as 'Receipt Doc No',
b.U_IssPSCName as 'SubContractor Name',
T2.ItemCode as 'FG Item Code',T3.ItemName as 'FG Item Name',T2.PlannedQty as 'FG Planned Qty',T2.U_OD as 'OD',T2.U_ID as 'ID',T2.U_OD/25.4 as 'Inches',(T2.U_OD-T2.U_ID)/2 as 'Width',case when ((T2.U_OD-T2.U_ID)/2) <30 then ((T2.U_OD-T2.U_ID)/2) *0.3 end, 0 as 'FG Pending Qty',0 as 'FG Receipt Qty','' as 'Issue Item Code','' as 'Issue Item Name',Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',0 as 'Issue Item - Return Quantity','' as 'Return Doc No',SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntryINNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCodeLEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode not in (a.ItemCode)LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode INNER JOIN OIGN d on c.DocEntry = d.DocEntryWHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID, T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2UNION ALL SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,T2.DocNum AS 'WorkOrderNo',
b.DocNum as 'Issue Doc No',
ISNULL(d.DocNum,'') as 'Receipt Doc No',
b.U_IssPSCName as 'SubContractor Name',
T2.ItemCode as 'Item Code',T3.ItemName as 'Item Name',T2.PlannedQty as 'Planned Qty',T2.U_OD as 'OD',T2.U_ID as 'ID',T2.U_OD/25.4 as 'Inches',(T2.U_OD-T2.U_ID)/2 as 'Width',case when ((T2.U_OD-T2.U_ID)/2) >=30 then ((T2.U_OD-T2.U_ID)/2) *0.37 end, (Select (T2.PlannedQty - (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum))) as 'Pending Qty',(Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum) as 'Receipt Qty',
a.ItemCode as 'Issued Item Code',
a.Dscription as 'Issued Item Name',
Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
(Select (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry
where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode))) as 'Issue Item - Return Quantity',
(ISNULL((Select (Select a2.DocNum from OIGN a2 where a2.DocEntry = a1.DocEntry) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode)),'')) as 'Return Doc No',
SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode in (a.ItemCode)
LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode LEFT JOIN OIGN d on c.DocEntry = d.DocEntry
WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,
T2.PlannedQty,T2.U_OD,
T2.U_ID,T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2,a.ItemCode,a.Dscription
order by T2.DocNum desc
Thanks & Regards,
Nagarajan -
How To Delete Multiple Query Elements in a Transport
Guys,
How do you delete Multiple Query Elements in a transport in DEV? Or it's not posible. I tried to select multiple but only one is being deleted.
Thanks,
ReccaHi Recca,
As Nanda said, just go to tcode SE03..Click Unlock Objects (Expert Tool)..Paste your TR number (one at a time) then click Unlock..
Go back to SE10 and delete your TR numbers..
Regards,
Loed -
I am a developer. Not sure if it was a programming thing or not but now FF 4.0.1 constantly opens up multiple windows each time I open it. Sometime around 3-4 and other times about 15 to 20 windows. I have searched your KB and Google and have tried every recommended fix but nothing helps. I am not infected, no malware and everything else is fine. I will provide remote access to my system via TeamViewer (or your option) if someone can please identify the problem or provide new details on how to troubleshoot this. I will have to find a new browser soon if this is not resolved. Many folks are suffering due to this...not just me.
This shit remains in Firefox 5. Nothing's changed.
Mozilla began to venture releasing a defective commodity. -
How to stop this multiple entry against same condition type in pricing
My client is using manual condition type for the basic price "ZBPR". Now system allowing multiple entry against this condition type in the pricing screen during order creation i.e in the first line if we put ZBPR 00 , in the second line system allowing to put another value against same ZBPR say for example 2000 & doing all subsequent calculations on the basis of 3000 .which is not at all acceptable by my client .Please suggest how to stop this multiple entry against same condition type
You have to make the condition type as Mandatory and not manual.
If you are entering many condition records of the ZPR0 then the latest entry will be taken for further processing for subtotal rebate and total price.
For all the other entered condition records will have yellow traffic signal which is not active.
you can assign a routine with the help pf your abaper...
In the Transaction VOFM define a requirement such that
you condition type takes value only one at the time of order entry.
regards,
Amlan Sarkar -
Now I have multiple folders in my external hard drive and want to know how to condense all folders into yearly folders instead. Anyone know how to do this?
anthonycancel wrote:
I want the folders I already backed up to come together into one folder when that year is over. Is there a way to manually do that or automatic through TM?
I'm quite sure there is no "automatic" way to do this. I've never heard of anyone trying it either. I suppose if you wanted try it, you could simply create a new folder in the same partition TM is on, label it for that year, then gather all the days for that year and drag/drop them into the folder. I suspect (but do not know) you'd be risking the continuity of your backups, meaning TM would simply start over again, meaning that next back up would start a new series of backups, with the first one roughly equalling the entire capacity of your internal HD, instead of adding only the new data to the previous backup. Once again, I would recommend against it, unless you're fine with TM starting a new series of backups if it doesn't work out the way you want it to. Hope you'll post back with results so we can learn from it. -
the query below , i am using in valueset :
select * from AR_LOCATION_VALUES
Where ar_location_values.location_segment_qualifier =
'COUNTRY' and ar_location_values.location_structure_id in ( select location_structure_id from ar_system_parameters )
how to use this query to set in R12?
Thankshi
i am using the following query in 11i and i want to use the same in R12 :
SELECT ar_location_values.location_segment_description,ar_location_values.location_segment_value,location_segment_id
FROM AR_LOCATION_VALUES
WHERE ar_location_values.location_segment_qualifier = 'COUNTRY'
AND ar_location_values.location_structure_id IN
(SELECT location_structure_id FROM ar_system_parameters)
note: the table ar_location_values is obsolette in R12 so what is the replacement table in R12 for this? -
How to Achieve this in SQL Query?
How to Achieve this ?
I have a table with numeric value populated like this
create table random_numeral (numerals Number(10));
insert into random_numeral values (1);
insert into random_numeral values (2);
insert into random_numeral values (3);
insert into random_numeral values (4);
insert into random_numeral values (5);
insert into random_numeral values (6);
insert into random_numeral values (56);
insert into random_numeral values (85);
insert into random_numeral values (24);
insert into random_numeral values (11);
insert into random_numeral values (120);
insert into random_numeral values (114);
Numerals
1
2
3
4
5
6
56
85
24
11
120
114
I want to display the data as follows
col1 / col2 / col3
1 / 2 / 3
4 / 5 / 6
11 / 24 / 56
85 / 114 / 120
Can anyone Help me?I hope there might be some simple way to do this and waiting for experts to reply.
Try the below query.
SQL> select * from random_numeral;
NUMERALS
1
2
3
4
5
6
56
85
24
11
120
NUMERALS
114
100
140
14 rows selected.
SQL> select a.numerals ||' / '||b.numerals||' / '||c.numerals from
2 (select numerals,rownum rn1 from
3 (
4 select numerals,mod(row_number() over(partition by 1 order by numerals),3)
5 from random_numeral
6 )
7 where rn=1) a,
8 (select numerals,rownum rn1 from
9 (
10 select numerals,mod(row_number() over(partition by 1 order by numerals),3)
11 from random_numeral
12 )
13 where rn=2) b,
14 (select numerals,rownum rn1 from
15 (
16 select numerals,mod(row_number() over(partition by 1 order by numerals),3)
17 from random_numeral
18 )
19 where rn=0) c
20 where a.rn1=b.rn1(+)
21 and b.rn1=c.rn1(+)
22 /
A.NUMERALS||'/'||B.NUMERALS||'/'||C.NUMERALS
1 / 2 / 3
4 / 5 / 6
11 / 24 / 56
85 / 100 / 114
120 / 140 /
SQL>Cheers,
Mohana -
I have installed HP2035n. But when i try to open the embedded web server, i get the error "Firefox doesn't know how to open this address, because the protocol (fe80) isn't associated with any program." What is the possible solution?
I typed in the IPv6 address of the printer in the address feild of firefox.Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode
Do a malware check with some malware scanning programs.<br />
You need to scan with all programs because each program detects different malware.<br />
Make sure that you update each program to get the latest version of their databases before doing a scan.<br />
* http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
* http://www.superantispyware.com/ - SuperAntispyware
* http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
* http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
* http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
See also:
* "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked -
How to execute this SQL Query in ABAP Program.
Hi,
I have a string which is the SQL Query.
How to execute this sql Query (SQL_STR) in ABAP Program.
Code:-
DATA: SQL_STR type string.
SQL_STR = 'select * from spfli.'.
Thanks in Advance,
VinayHi Vinay
Here is a sample to dynamically generate a subroutine-pool having your SQL and calling it.
REPORT dynamic_sql_example .
DATA: BEGIN OF gt_itab OCCURS 1 ,
line(80) TYPE c ,
END OF gt_itab .
DATA gt_restab TYPE .... .
DATA gv_name(30) TYPE c .
DATA gv_err(120) TYPE c .
START-OF-SELECTION .
gt_itab-line = 'REPORT generated_sql .' .
APPEND gt_itab .
gt_itab-line = 'FORM exec_sql CHANGING et_table . ' .
APPEND gt_itab .
gt_itab-line = SQL_STR .
APPEND gt_itab .
gt_itab-line = 'ENDFORM.' .
APPEND gt_itab .
GENERATE SUBROUTINE POOL gt_itab NAME gv_name MESSAGE gv_err .
PERFORM exec_sql IN PROGRAM (gv_name) CHANGING gt_restab
IF FOUND .
WRITE:/ gv_err .
LOOP AT gt_result .
WRITE:/ .... .
ENDLOOP .
*--Serdar -
How to write this sql query in php code ?
for example:
insert into temp
select *
from testtable;
after this, i will query data from sql below:
select *
from temp;
how to write this php code ?
who can help me ?
thanks!Have a look at the manual to find out how to issue queries.
http://us3.php.net/oci8 -
How can i pass a parameter to the query to filter the result of this lookup
Hello,
i'm developping a web application with JDeveloper 10.1.2 and JHeadStart.
i realy need to know how can i filter the lookup (LOV) query result.
in other word, when i click on the lookup, it show all the row that exist in may data base table.
what i want is how can i pass a parameter to the query to filter the result of this lookup ?
Thank youHi,
have a look if this helps
http://oracle.com/technology/products/jdev/tips/fnimphius/restrictlovlist/restrictlov.html
Frank
Maybe you are looking for
-
How many thousands of Apple TV users have to scream their complaints before Apple will respond to the fury over the impossibly slow download speeds of movies bought through iTunes?
-
SOAP error when publishing Infopath form to Sharepoint
Hi - this is my 1st post and I hope someone can help with a problem I have. From Sharepoint, I took the list option to "Customize Form". I then customized the form in infopath 2010 and tried to publish but it comes up with the error: "The publish ope
-
Condition types + SD invoices
Hello all BW friends, I need to be able to report on: net amount, net quantity, rebate and cost of sales per material, plant and calendar day. All this info is not available in the same extractor. I have to use both 2_LIS_13_SD-item + 2_LIS_13_condit
-
my fire fox his magnify so large i can't use it . just on face book started about a month ago after use it for a year . i have to use another.'''bold text'''
-
OT: SMImage plugin now also available for FCKEditor
Hi folks, a while ago I´ve written a tutorial on how to integrate Jens Stolisnki´s pretty cool TinyMCE image management plugin "SMImage" into ADDT forms -- well, Jens just told me that he has now developed a plugin version for FCKEditor. Cheers, Günt