Sqlserver query using Group by and Order by
SUM(BILL_DETAIL.x_bill_quantity) as BILL_QUANTITY,
MIN(BILL_DETAIL.x_billable_to) as BILLABLE_TO,
MIN(BILL_DETAIL.x_billable_yn) as BILLABLE_YN,
AVG(BILL_DETAIL.x_bill_rate) as BILL_RATE,
MIN(BILL_DETAIL.x_cost_rate) as COST_RATE,
MIN(BILL_DETAIL.x_cost_total) as COST_TYPE,
LISTAGG(BILL_DETAIL.objid, ',') WITHIN GROUP(ORDER BY BILL_DETAIL.objid) as ID_LIST
FROM table_x_gsa_bill_detail BILL_DETAIL
WHERE (1=1)
GROUP BY (DECODE(BILLABLE_YN, 1, 'Billable', 'Non-Billable') || ',' || BILLABLE_TO || ',' || DETAIL_CLASS || ',' || COST_TYPE || ',' || BILL_RATE)
ORDER BY DECODE(BILLABLE_YN, 1, 'Billable', 'Non-Billable') || ',' || BILLABLE_TO || ',' || DETAIL_CLASS ||
) dt WHERE rn BETWEEN 0 AND 1
Can any one pls help me using of Case Condition keyword instead of Decode in the above query ??? iam not able to convert above query for group by and order by..
Actually i need to do group by the aggragate values which i got the values from the fields of BILLABLE_YN,BILLABLE_TO,DETAIL_CLASS, COST_TYPE, BILL_RATE.
where as in oracle i can run above query using decode keyword where as in sqlserver iam not able to use BILLABLE_YN field alias of above query in group by .
i tried like by using following way but it is wrong because here iam not using aggragate values of fields in group by funtion please help me in converting query in sqlserver. GROUP BY (case BILLABLE_YN when 1 then 'Billable' when 0 then 'Non-Billable' else
'Non-Billable' End BILLABLE_YN + ',' + BILLABLE_TO + ',' + DETAIL_CLASS + ',' + COST_TYPE + ',' + BILL_RATE)
Krishna
CREATE TABLE DETAIL
([objid] int,[x_billable_to] varchar(19), [x_bill_quantity] int,
[x_billable_yn] int, [x_bill_rate] int, [COST_TYPE] varchar(19) )
INSERT INTO
DETAIL
([objid], [x_billable_to], [x_bill_quantity], [x_billable_yn], [x_bill_rate],[COST_TYPE])
VALUES
(1, 'Customer', 3, 1, 20,'Parking'),
(2, 'Customer', 1, 1, 25,'Toll'),
(3, 'Customer', 2, 1, 20,'Parking')
Pls convert following query for executing query in sqlserver ..for the column ID_List it should return data like 1,2,3
SELECT * FROM (SELECT 1 rn,
SUM(BILL_DETAIL.x_bill_quantity) as BILL_QUANTITY,
MIN(BILL_DETAIL.x_billable_to) as BILLABLE_TO,
MIN(BILL_DETAIL.x_billable_yn) as BILLABLE_YN,
AVG(BILL_DETAIL.x_bill_rate) as BILL_RATE,
LISTAGG(BILL_DETAIL.objid, ',') WITHIN GROUP(ORDER BY BILL_DETAIL.objid) as ID_LIST
FROM BILL_DETAIL
WHERE (1=1)
GROUP BY (DECODE(x_billable_yn, 1, 'Billable', 'Non-Billable') + ',' + x_billable_to + ',' + COST_TYPE + ',' + x_bill_rate)
ORDER BY DECODE(x_billable_yn, 1, 'Billable', 'Non-Billable') + ',' + x_billable_to + ',' + COST_TYPE + ',' + x_bill_rate
)dt
WHERE rn BETWEEN 0 AND 1
Krishna
sounds like this
SELECT *
FROM
SELECT 1 rn,
SUM(BILL_DETAIL.x_bill_quantity) as BILL_QUANTITY,
MIN(BILL_DETAIL.x_billable_to) as BILLABLE_TO,
MIN(BILL_DETAIL.x_billable_yn) as BILLABLE_YN,
AVG(BILL_DETAIL.x_bill_rate) as BILL_RATE,
LEFT(bd1.ID_LIST,LEN(bd1.ID_LIST)-1) AS ID_Listing
FROM BILL_DETAIL bd
CROSS APPLY (
SELECT BILL_DETAIL.objid + ',' AS [text()]
FROM BILL_DETAIL
WHERE objid = bd.objid
FOR XML PATH('')
)bd1(ID_LIST)
WHERE (1=1)
GROUP BY (CASE WHEN x_billable_yn = 1 THEN 'Billable' ELSE 'Non-Billable'END + ',' + x_billable_to + ',' + COST_TYPE + ',' + x_bill_rate),
LEFT(bd1.ID_LIST,LEN(bd1.ID_LIST)-1)
ORDER BY (CASE WHEN x_billable_yn = 1 THEN 'Billable' ELSE 'Non-Billable'END + ',' + x_billable_to + ',' + COST_TYPE + ',' + x_bill_rate),
LEFT(bd1.ID_LIST,LEN(bd1.ID_LIST)-1)
)dt
WHERE rn BETWEEN 0 AND 1
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page
Similar Messages
-
SQL query using Group by and Aggregate function
Hi All,
I need your help in writing an SQL query to achieve the following.
Scenario:
I have table with 3 Columns. There are 3 possible values for col3 - Success, Failure & Error.
Now I need a query which can give me the summary counts for distinct values of col3 for each GROUP BY of col1 and col2 values. When there are no values for col3 then it should return ZERO count.
Example Data:
Col1 Col2 Col3
abc 01 success
abc 02 success
abc 01 success
abc 01 Failure
abc 01 Error
abc 02 Failure
abc 03 Error
xyz 07 Failure
Required Output:
c1 c2 s_cnt F_cnt E_cnt (Heading)
abc 01 2 1 1
abc 02 1 1 0
abc 03 0 0 1
xyz 07 0 1 0
s_cnt = Success count; F_cnt = Failure count; E_cnt = Error count
Please note that the output should have 5 columns with col1, col2, group by (col1,col2)count(success), group by (col1,col2)count(failure), group by (col1,col2)count(error)
and where ever there are NO ROWS then it should return ZERO.
Thanks in advance.
Regards,
ShivaHi,
user13015050 wrote:
Thanks TTT. Unfortunately I cannot use this solution because I have huge data for this.T's solution is basically the same as mine. The first 23 lines just simulates your table. Since you actually have a table, you would start with T's line 24:
SELECT col1 c1, col2 c2, SUM(decode(col3, 'success', 1, 0)) s_cnt, ...
user13015050 wrote:Thanks a lot Frank. It helped me out. I just did some changes to this as below and have no issues.
SELECT col1
, col2
, COUNT ( CASE
WHEN col3 = 'SUCCESS'
THEN 1
END
) AS s_cnt
, COUNT ( CASE
WHEN col3 = 'FAILED'
THEN 1
END
) AS f_cnt
, COUNT ( CASE
WHEN col3 = 'ERROR'
THEN 1
END
) AS e_cnt
FROM t1
WHERE c2 in ('PURCHASE','REFUND')
and c4 between to_date('20091031000000','YYYYMMDDHH24MISS') AND to_date('20100131235959','YYYYMMDDHH24MISS')
GROUP BY c1, c2
ORDER BY c1, c2;
Please let me know if you see any issues in this query.It's very hard to read.
This site normally compresses spaces. Whenever you post formatted text (such as queries or 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.
Also, post exactly what you're using. The code above is SELECTing col1 and col2, but there's no mention of either in the GROUP BY clause, so I don't believe it's really what you're using.
Other than that, I don't see anything wrong or suspicious in the query. -
How to write a query with group by and order by for a date column
I have a query:
select count(*), to_char(s.pdate,'Mon-yyyy') as month from sTable s
group by to_char(s.pdate,'Mon-yyyy')
order by to_date(s.pdate,'Mon-yyyy')
However, I got an error: not a GROUP By expression.
If i just run: select count(*), to_char(s.pdate,'Mon-yyyy') as month from sTable s
group by to_char(s.pdate,'Mon-yyyy')
it is work fine.
How to solve the problem.
Thanks,
JenJen,
You can use this code
with sTable as (select to_date('01/01/2009', 'dd/mm/yyyy') pdate, 1 code from dual union all
select to_date('02/02/2009', 'dd/mm/yyyy') a, 2 code from dual union all
select to_date('01/03/2009', 'dd/mm/yyyy') d, 3 code from dual union all
select to_date('05/04/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/05/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/06/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/07/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/08/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/09/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/10/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/11/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/12/2009', 'dd/mm/yyyy') h, 5 code from dual)
select cnt, to_char(to_date(mnt||'01', 'yyyymmdd'), 'Mon-yyyy')
from (select count(*) cnt, to_char(s.pdate,'yyyymm') as mnt
from sTable s
group by to_char(s.pdate,'yyyymm')
order by to_char(s.pdate,'yyyymm')
CNT MONTH
1 Jan-2009
1 Feb-2009
1 Mar-2009
1 Apr-2009
1 May-2009
1 Jun-2009
1 Jul-2009
1 Aug-2009
1 Sep-2009
1 Oct-2009
1 Nov-2009
1 Dec-2009
12 rows selectedyour problem was that you are using a expresión in the order by (to_date...) that is distinct to the query results (to_char...).
Regards,
Mike -
Hi,
I have wriiten the below query and i am using group by and order by clause....but i am not getting the required result
SELECT b.ACCOUNT_REGION,CASE WHEN b.product_reference_status='Reference' THEN 'Recruited' WHEN b.product_reference_status in ('Inactive','Declined') THEN 'Inactive' WHEN b.product_reference_status ='Nominate' THEN 'Inprogress' ELSE 'Other' END product_reference_status, COUNT(decode(b.product_quarter,'Q1FY09',b.REFERENCE_ID)) Q1FY09, COUNT(decode(b.product_quarter,'Q2FY09',b.REFERENCE_ID)) Q2FY09, COUNT(decode(b.product_quarter,'Q3FY09',b.REFERENCE_ID)) Q3FY09, COUNT(decode(b.product_quarter,'Q4FY09',b.REFERENCE_ID)) Q4FY09, COUNT(decode(b.product_quarter,'Q1FY10',b.REFERENCE_ID)) Q1FY10, COUNT(decode(b.product_quarter,'Q2FY10',b.REFERENCE_ID)) Q2FY10, COUNT(decode(b.product_quarter,'Q3FY10',b.REFERENCE_ID)) Q3FY10, COUNT(decode(b.product_quarter,'Q4FY10',b.REFERENCE_ID)) Q4FY10, COUNT(b.product_quarter) Total
FROM refdump a, ref_dh_pr b
WHERE A.REFERENCE_ID=b.REFERENCE_ID AND (b.CREATED_ON - NVL(a.REFERENCE_DATE,a.CREATED))>15 group by b.account_region,product_reference_status order by 2
output is as given below
Region Status Count
LAD Inactive 0
EMEA Inactive 21
*APAC Inactive 2
*APAC Inactive 1
EMEA Inactive 2
EMEA Inprogress 220
LAD Inprogress 19
LAD Other 2
LAD Other 0
LAD Other 5
LAD Recruited 182
APAC Recruited 191
My question is
1) Why i am geeting two APAC regions and 3 LAD (marked *) regions when i have grouped by region and status
2) How can i make the status in the following order
a) Recruited
b)Inprogress
c)Inactive
d)Other
Thanks,<i>group by b.account_region,product_reference_status</i>
Just take all the columns in the group by clause in your select segment and run the SQL, you'll come to know abt the different values in columns which group together.
*009* -
Execution order - group by and order by
is there any execution order when we use group by and order by together in single query ?
BOL: "Logical Processing Order of the SELECT statement
The following steps show the logical processing order, or binding order, for a SELECT statement. This order determines when the objects defined in one step are made available to the clauses in subsequent steps. For example, if the query processor can bind to
(access) the tables or views defined in the FROM clause, these objects and their columns are made available to all subsequent steps. Conversely, because the SELECT clause is step 8, any column aliases or derived columns defined in that clause cannot be referenced
by preceding clauses. However, they can be referenced by subsequent clauses such as the ORDER BY clause. Note that the actual physical execution of the statement is determined by the query processor and the order may vary from this list.
1. FROM
2. ON
3. JOIN
4. WHERE
5. GROUP BY
6. WITH CUBE or WITH ROLLUP
7. HAVING
8. SELECT
9. DISTINCT
10. ORDER BY
11. TOP"
http://msdn.microsoft.com/en-us/library/ms189499.aspx
Kalman Toth Database & OLAP Architect
IPAD SELECT Query Video Tutorial 3.5 Hours
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
How can I deploy EFS using Group Policy and Active Directory with a goal to automatically encrypt computers for ALL users who login? (NOT an option for me to use BitLocker)
I was asked to deploy EFS to encrypt the user my documents folder and profile on all of the users laptops. The laptops are in common areas (board meeting rooms, etc) and security of files is a must.
I successfully created a recovery certificate in AD. I created an OU and setup an EFS policy and users can now login and select to encrypt their own files. The issue is that management would like to have automaticy Encrypt ALL users my documents AUTOMATICALLY
when a user login.
Can this be done?
Please helpHi,
Any update?
Just checking in to see if the suggestions were helpful. Please let us know if you would like further assistance.
Best Regards,
Andy Qi
TechNet Subscriber Support
If you are
TechNet Subscription user and have any feedback on our support quality, please send your feedback
here.
Andy Qi
TechNet Community Support -
I have a table like the example below. I am looking to get
the results like the example - I have included my code that I have
this far, but it is not giving me the right results.
Can someone point me in the right direction?
This is what I want it to do:
orders table
orderid | vendor | product | color | size
1 | sammoon | watch | silver | Large
2 | beckam | necklace | silver | Medium
3 | sammoon | watch | silver | large
4 | sammoon | watch | gold | Medium
5 | beckam | necklace | gold | medium
6 | switse | ring | gold | small
7 | sammoon | earring | silver | small
8 | switse | ring | gold | medium
9 | beckam | necklace | gold | small
10 | switse | necklace | platinum | large
Results for Report
Sammoon
watch
Large
1 - Silver
3 - Silver
Medium
4 - Gold
earrings
Small
7 - silver
Beckam
Necklace
Medium
2 - silver
5 - gold
Small
9 - gold
Switse
Ring
Medium
8 - gold
Small
6 - gold
Necklace
Large
10 - platinum
This is my current code (note: not exactly like example but
same principle):
<CFOUTPUT>
<CFQUERY name="q1" datasource="#DSN#" username="#USER#"
password="#PASS#">
SELECT avendor,orderid
FROM smorders s
WHERE orderstatus='released to production'
Group By avendor,orderid
Order By avendor
</CFQUERY>
<CFLOOP query="q1">
#q1.avendor#<BR>
<CFQUERY name="q2" datasource="#DSN#" username="#USER#"
password="#PASS#">
SELECT vasku,shortdesc
FROM smorders s
WHERE avendor='#q1.avendor#'
Group By vasku,shortdesc
Order By vasku
</CFQUERY>
<CFLOOP query="q2">
#vasku# -
#q2.shortdesc#<BR>
<CFQUERY name="q3" datasource="#DSN#" username="#USER#"
password="#PASS#">
SELECT color
FROM smorders
WHERE avendor='#q1.avendor#'
GROUP BY color
ORDER BY color
</CFQUERY>
<CFLOOP query="q3">
#q3.color#<BR>
<CFQUERY name="q4" datasource="#DSN#" username="#USER#"
password="#PASS#">
SELECT size,orderid
FROM smorders
WHERE avendor='#q1.avendor#' and orderid=#q1.orderid#
GROUP BY size,orderid
ORDER BY size
</CFQUERY>
<CFLOOP query="q4">
Order
##: #q4.orderid# - Size: #q4.size#<BR>
</CFLOOP>
</CFLOOP>
</CFLOOP>
</CFLOOP>
</CFOUTPUT>
Anyone? Thanks in advance.No need for all those nested queries. If I'm understanding
correctly, you only need 1 query and a series of nested cfoutput
statements. Use an ORDER BY clause to order the results the way you
want them grouped.
Sammoon (By Vendor)
watch (then by Product)
Large (then by Size)
1 - Silver (then by Color) (and finally by OrderId)
3 - Silver
Medium
4 - Gold
earrings
Small
7 - silver
So your SQL clause would be: ORDER BY Vendor, Product, Size,
Color then OrderId. Finally use nested cfoutput statements to group
the output. See the attached example
I noticed your table contains duplicated data. If that is the
actual table structure you should consider normalizing to eliminate
the duplication. You should have a separate table for the distinct
Products, Colors, Sizes and Vendors and the orders table should
store the id's not the names.
Table | Columns
Product | ProductID, ProductName
Vendor | VendorID, VendorName
Color | ColorID, ColorName
Size | SizeID, SizeName
SMOrders | OrderId, ProductID, VendorID, ColorID, SizeID -
XML Publisher nested grouping, sum and order by question
Please help in nested group by, sum and order by question
My Data look like this:
<Header>
<Line1>
<Part Number></Part Number>
<Component>
<Component1></Component1>
<Component1 Amount></Component1 Amount>
</Component>
<Component>
<Component2></Component2>
<Component2 Amount></Component2 Amount>
</Component>
</Line1>
<Line2>
<Part Number></Part Number>
<Component>
<Component1></Component1>
<Component1 Amount></Component1 Amount >
</Component>
<Component>
<Component2></Component2>
<Component2 Amount ></Component2 Amount >
</Component>
</Line2>
</Header>
I want to print report which is:
1. Group by part number, component and sum the amount for a part number/component
2. Order by part number, component
Here is rtf file for XML publisher report
<?for-each-group:G_LINES;PART_NUMBER?>
<?sort:G_LINES;PART_NUMBER;'ascending';data-type='text'?>
<?if:BREAKDOWN_COUNT>0?>
Part Number: <?PART_NUMBER?> Quantity: <?sum (current-group()/SHIP_QTY)?> Part Count:<?count(current-group()/PART_NUMBER)?> Breakdown Count:<?count(G_BREAKDOWN/COMPONENT)?>
<?for-each:current-group()?>
<?for-each-group:G_BREAKDOWN;COMPONENT?>
Component: <?COMPONENT?> Price: <?COMPONENT_PRICE?>
<?end-for-each?>
<?end-for-each?>
<?end if?>
<?end-for-each?>
If I add <?sort:G_BREAKDOWN;COMPONENT;'ascending';data-type='text'?> inside G_BREAKDOWN grouping it gives error.
My XML data file
<?xml version="1.0"?>
<!-- Generated by Oracle Reports version 6.0.8.25.0 -->
<NI_COMMERCIAL_INVOICE_XMLP>
<LIST_G_HEADER>
<G_HEADER>
<COMM_INV_NUMBER>C/901000598</COMM_INV_NUMBER>
<COMM_INV_VERSION_NUMBER>1</COMM_INV_VERSION_NUMBER>
<SHIP_FROM_NAME>National Instruments Europe Corp.</SHIP_FROM_NAME>
<SHIP_FROM_ADDR>H-4031, Debrecen, Hatar ut 1/A</SHIP_FROM_ADDR>
<SHIP_FROM_CITY></SHIP_FROM_CITY>
<SHIP_FROM_STATE></SHIP_FROM_STATE>
<SHIP_FROM_POSTAL_CODE></SHIP_FROM_POSTAL_CODE>
<SHIP_FROM_COUNTRY>Hungary</SHIP_FROM_COUNTRY>
<SHIP_TO_NAME>National Instruments Corporation (NIEC)</SHIP_TO_NAME>
<FORMATTED_SHIP_TO_ADDR>11500 N Mopac Expwy
Austin, TX 78759-3504
United States</FORMATTED_SHIP_TO_ADDR>
<SHIP_TO_ADDR1>11500 N Mopac Expwy</SHIP_TO_ADDR1>
<SHIP_TO_ADDR2></SHIP_TO_ADDR2>
<SHIP_TO_ADDR3></SHIP_TO_ADDR3>
<SHIP_TO_ADDR4></SHIP_TO_ADDR4>
<SHIP_TO_CITY>Austin</SHIP_TO_CITY>
<SHIP_TO_STATE>TX </SHIP_TO_STATE>
<SHIP_TO_POSTAL_CODE>78759-3504</SHIP_TO_POSTAL_CODE>
<SHIP_TO_COUNTRY>US</SHIP_TO_COUNTRY>
<SHIP_TO_EMAIL_ADDR></SHIP_TO_EMAIL_ADDR>
<BILL_TO_ORG_ID>807737</BILL_TO_ORG_ID>
<SHIPPED_VIA>UPS</SHIPPED_VIA>
<DELIVERY_TERM>DDU</DELIVERY_TERM>
<TEXT_FILE_SEPARATOR></TEXT_FILE_SEPARATOR>
<DELIVERY_COUNT>4</DELIVERY_COUNT>
<HEADER_WAYBILL></HEADER_WAYBILL>
<LIST_G_LINES>
<G_LINES>
<DELIVERY_ID>2629769</DELIVERY_ID>
<ORDER_HEADER_ID>1431282</ORDER_HEADER_ID>
<ORDER_NUMBER>10004434</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-387</CUST_PO_NUMBER>
<ORDER_LINE_ID>4565737</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>26818</INVENTORY_ITEM_ID>
<PART_NUMBER>777459-23</PART_NUMBER>
<PART_DESC>SCC-AI04, 2-CHANNEL ISOLATED ANALOG INPUT</PART_DESC>
<PART_CUSTOM_DESC>SCC-AI04, Automatic Data Processing Plug-In Board</PART_CUSTOM_DESC>
<PLANNER_CODE>SCXIH-MPS</PLANNER_CODE>
<HTS_CODE>8471.80.9000</HTS_CODE>
<TARIC_CODE>8471.80.0000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>158</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>4</ORIG_SHIP_QTY>
<UNIT_PRICE>158</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>158</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>4</SHIP_QTY>
<EXTENDED_PRICE>632</EXTENDED_PRICE>
<UNIT_WEIGHT>.16</UNIT_WEIGHT>
<NET_WEIGHT>.64</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/01 NIC</WAYBILL>
<BREAKDOWN_COUNT>0</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE></BREAKDOWN_TYPE>
<BREAKDOWN_VALUE></BREAKDOWN_VALUE>
<COMPONENT></COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE></COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO></COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
<G_LINES>
<DELIVERY_ID>2629769</DELIVERY_ID>
<ORDER_HEADER_ID>1431282</ORDER_HEADER_ID>
<ORDER_NUMBER>10004434</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-387</CUST_PO_NUMBER>
<ORDER_LINE_ID>4579950</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>143949</INVENTORY_ITEM_ID>
<PART_NUMBER>779475-01</PART_NUMBER>
<PART_DESC>SCC-68 I/O CONNECTOR BLOCK WITH 4 SCC SIGNAL CONDITIONING MODULE SLOTS</PART_DESC>
<PART_CUSTOM_DESC>SCC-68, Screw Terminals</PART_CUSTOM_DESC>
<PLANNER_CODE>DAQH-MPS</PLANNER_CODE>
<HTS_CODE>8536.90.4000</HTS_CODE>
<TARIC_CODE>8536.90.1000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>144</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>10</ORIG_SHIP_QTY>
<UNIT_PRICE>144</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>144</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>10</SHIP_QTY>
<EXTENDED_PRICE>1440</EXTENDED_PRICE>
<UNIT_WEIGHT>1.06</UNIT_WEIGHT>
<NET_WEIGHT>10.6</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/01 NIC</WAYBILL>
<BREAKDOWN_COUNT>3</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>CD</COMPONENT>
<COMPONENT_DESC>Test1</COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>50</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2803.00.0050</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE>Test1</COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY>10</COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>Paper</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>20</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2839.90.0000</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>IP</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>1370</COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
<G_LINES>
<DELIVERY_ID>2629822</DELIVERY_ID>
<ORDER_HEADER_ID>1425429</ORDER_HEADER_ID>
<ORDER_NUMBER>10004365</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-372</CUST_PO_NUMBER>
<ORDER_LINE_ID>4579940</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>22643</INVENTORY_ITEM_ID>
<PART_NUMBER>777687-20</PART_NUMBER>
<PART_DESC>SCXI-1320 TEMPERATURE SENSOR TERMINAL BLOCK, CAST</PART_DESC>
<PART_CUSTOM_DESC>SCXI-1320, Screw Terminals</PART_CUSTOM_DESC>
<PLANNER_CODE>SCXIH-MPS</PLANNER_CODE>
<HTS_CODE>8536.90.4000</HTS_CODE>
<TARIC_CODE>8536.90.1000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>82</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>1</ORIG_SHIP_QTY>
<UNIT_PRICE>82</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>82</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>1</SHIP_QTY>
<EXTENDED_PRICE>82</EXTENDED_PRICE>
<UNIT_WEIGHT>.57</UNIT_WEIGHT>
<NET_WEIGHT>.57</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/02 NIC</WAYBILL>
<BREAKDOWN_COUNT>3</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>CD</COMPONENT>
<COMPONENT_DESC>Test1</COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>5</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2803.00.0050</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE>Test1</COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY>1</COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>Paper</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>2</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2839.90.0000</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>IP</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>75</COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
<G_LINES>
<DELIVERY_ID>2629822</DELIVERY_ID>
<ORDER_HEADER_ID>1427673</ORDER_HEADER_ID>
<ORDER_NUMBER>10004391</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-377</CUST_PO_NUMBER>
<ORDER_LINE_ID>4579948</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>143949</INVENTORY_ITEM_ID>
<PART_NUMBER>779475-01</PART_NUMBER>
<PART_DESC>SCC-68 I/O CONNECTOR BLOCK WITH 4 SCC SIGNAL CONDITIONING MODULE SLOTS</PART_DESC>
<PART_CUSTOM_DESC>SCC-68, Screw Terminals</PART_CUSTOM_DESC>
<PLANNER_CODE>DAQH-MPS</PLANNER_CODE>
<HTS_CODE>8536.90.4000</HTS_CODE>
<TARIC_CODE>8536.90.1000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>144</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>13</ORIG_SHIP_QTY>
<UNIT_PRICE>144</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>144</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>13</SHIP_QTY>
<EXTENDED_PRICE>1872</EXTENDED_PRICE>
<UNIT_WEIGHT>1.06</UNIT_WEIGHT>
<NET_WEIGHT>13.78</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/02 NIC</WAYBILL>
<BREAKDOWN_COUNT>3</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>CD</COMPONENT>
<COMPONENT_DESC>Test1</COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>65</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2803.00.0050</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE>Test1</COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY>13</COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>Paper</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>26</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2839.90.0000</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>IP</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>1781</COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
<G_LINES>
<DELIVERY_ID>2630021</DELIVERY_ID>
<ORDER_HEADER_ID>1429687</ORDER_HEADER_ID>
<ORDER_NUMBER>10004410</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-383</CUST_PO_NUMBER>
<ORDER_LINE_ID>4578220</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>61816</INVENTORY_ITEM_ID>
<PART_NUMBER>777687-14</PART_NUMBER>
<PART_DESC>SCXI-1314 FRONT MOUNTING TERMINAL BLOCK</PART_DESC>
<PART_CUSTOM_DESC>SCXI-1314, Screw Terminals</PART_CUSTOM_DESC>
<PLANNER_CODE>SCXIH-MPS</PLANNER_CODE>
<HTS_CODE>8536.90.4000</HTS_CODE>
<TARIC_CODE>8536.90.1000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>120</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>4</ORIG_SHIP_QTY>
<UNIT_PRICE>120</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>120</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>4</SHIP_QTY>
<EXTENDED_PRICE>480</EXTENDED_PRICE>
<UNIT_WEIGHT>.68</UNIT_WEIGHT>
<NET_WEIGHT>2.72</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/03 NIC</WAYBILL>
<BREAKDOWN_COUNT>3</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>CD</COMPONENT>
<COMPONENT_DESC>Test1</COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>20</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2803.00.0050</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE>Test1</COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY>4</COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>IP</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>452</COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>Paper</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>8</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2839.90.0000</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
<G_LINES>
<DELIVERY_ID>2630054</DELIVERY_ID>
<ORDER_HEADER_ID>1435114</ORDER_HEADER_ID>
<ORDER_NUMBER>10004463</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-396</CUST_PO_NUMBER>
<ORDER_LINE_ID>4580160</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>96909</INVENTORY_ITEM_ID>
<PART_NUMBER>778729-01</PART_NUMBER>
<PART_DESC>NI PCI-4474, 4 INPUTS, 24-BIT DYNAMIC SIGNAL ACQUISITION</PART_DESC>
<PART_CUSTOM_DESC>PCI-4474, Automatic Data Processing Plug-In Board</PART_CUSTOM_DESC>
<PLANNER_CODE>INSTRHMPS</PLANNER_CODE>
<HTS_CODE>8471.80.4000</HTS_CODE>
<TARIC_CODE>8471.80.0000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>960</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>4</ORIG_SHIP_QTY>
<UNIT_PRICE>960</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>960</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>4</SHIP_QTY>
<EXTENDED_PRICE>3840</EXTENDED_PRICE>
<UNIT_WEIGHT>.68</UNIT_WEIGHT>
<NET_WEIGHT>2.72</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/04 NIC</WAYBILL>
<BREAKDOWN_COUNT>0</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE></BREAKDOWN_TYPE>
<BREAKDOWN_VALUE></BREAKDOWN_VALUE>
<COMPONENT></COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE></COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO></COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
</LIST_G_LINES>
</G_HEADER>
</LIST_G_HEADER>
</NI_COMMERCIAL_INVOICE_XMLP>
I want my report for part number (which has multiple component) look like:
Part Number: 779475-01 Quantity: 23 Part Count:2 Breakdown Count:6
Component: CD Amount: 115
Component: IP Amount: 3151
Component: Paper Amount: 46
Any help or suggestion is appreciated
RK Shah
[email protected]I am using the latest 10.1.3.2.1 build 87.
The output that I see is :
Part Number: 777687-14 Quantity: 4 Part Count:1 Breakdown Count:3
Component: CD
Count: 4
Sum of Component Price: 20
Component: IP
Count: 0
Sum of Component Price: 452
Component: Paper
Count: 0
Sum of Component Price: 8
Part Number: 777687-20 Quantity: 1 Part Count:1 Breakdown Count:3
Component: CD
Count: 1
Sum of Component Price: 5
Component: Paper
Count: 0
Sum of Component Price: 2
Component: IP
Count: 0
Sum of Component Price: 75
Part Number: 779475-01 Quantity: 23 Part Count:2 Breakdown Count:3
Component: CD
Count: 23
Sum of Component Price: 115
Component: Paper
Count: 0
Sum of Component Price: 46
Component: IP
Count: 0
Sum of Component Price: 3151
and the XML data that I used is :
<?xml version="1.0"?>
<!-- Generated by Oracle Reports version 6.0.8.25.0 -->
<NI_COMMERCIAL_INVOICE_XMLP>
<LIST_G_HEADER>
<G_HEADER>
<COMM_INV_NUMBER>C/901000598</COMM_INV_NUMBER>
<COMM_INV_VERSION_NUMBER>1</COMM_INV_VERSION_NUMBER>
<SHIP_FROM_NAME>National Instruments Europe Corp.</SHIP_FROM_NAME>
<SHIP_FROM_ADDR>H-4031, Debrecen, Hatar ut 1/A</SHIP_FROM_ADDR>
<SHIP_FROM_CITY></SHIP_FROM_CITY>
<SHIP_FROM_STATE></SHIP_FROM_STATE>
<SHIP_FROM_POSTAL_CODE></SHIP_FROM_POSTAL_CODE>
<SHIP_FROM_COUNTRY>Hungary</SHIP_FROM_COUNTRY>
<SHIP_TO_NAME>National Instruments Corporation (NIEC)</SHIP_TO_NAME>
<FORMATTED_SHIP_TO_ADDR>11500 N Mopac Expwy
Austin, TX 78759-3504
United States</FORMATTED_SHIP_TO_ADDR>
<SHIP_TO_ADDR1>11500 N Mopac Expwy</SHIP_TO_ADDR1>
<SHIP_TO_ADDR2></SHIP_TO_ADDR2>
<SHIP_TO_ADDR3></SHIP_TO_ADDR3>
<SHIP_TO_ADDR4></SHIP_TO_ADDR4>
<SHIP_TO_CITY>Austin</SHIP_TO_CITY>
<SHIP_TO_STATE>TX </SHIP_TO_STATE>
<SHIP_TO_POSTAL_CODE>78759-3504</SHIP_TO_POSTAL_CODE>
<SHIP_TO_COUNTRY>US</SHIP_TO_COUNTRY>
<SHIP_TO_EMAIL_ADDR></SHIP_TO_EMAIL_ADDR>
<BILL_TO_ORG_ID>807737</BILL_TO_ORG_ID>
<SHIPPED_VIA>UPS</SHIPPED_VIA>
<DELIVERY_TERM>DDU</DELIVERY_TERM>
<TEXT_FILE_SEPARATOR></TEXT_FILE_SEPARATOR>
<DELIVERY_COUNT>4</DELIVERY_COUNT>
<HEADER_WAYBILL></HEADER_WAYBILL>
<LIST_G_LINES>
<G_LINES>
<DELIVERY_ID>2629769</DELIVERY_ID>
<ORDER_HEADER_ID>1431282</ORDER_HEADER_ID>
<ORDER_NUMBER>10004434</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-387</CUST_PO_NUMBER>
<ORDER_LINE_ID>4565737</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>26818</INVENTORY_ITEM_ID>
<PART_NUMBER>777459-23</PART_NUMBER>
<PART_DESC>SCC-AI04, 2-CHANNEL ISOLATED ANALOG INPUT</PART_DESC>
<PART_CUSTOM_DESC>SCC-AI04, Automatic Data Processing Plug-In Board</PART_CUSTOM_DESC>
<PLANNER_CODE>SCXIH-MPS</PLANNER_CODE>
<HTS_CODE>8471.80.9000</HTS_CODE>
<TARIC_CODE>8471.80.0000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>158</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>4</ORIG_SHIP_QTY>
<UNIT_PRICE>158</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>158</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>4</SHIP_QTY>
<EXTENDED_PRICE>632</EXTENDED_PRICE>
<UNIT_WEIGHT>.16</UNIT_WEIGHT>
<NET_WEIGHT>.64</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/01 NIC</WAYBILL>
<BREAKDOWN_COUNT>0</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE></BREAKDOWN_TYPE>
<BREAKDOWN_VALUE></BREAKDOWN_VALUE>
<COMPONENT></COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE></COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO></COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
<G_LINES>
<DELIVERY_ID>2629769</DELIVERY_ID>
<ORDER_HEADER_ID>1431282</ORDER_HEADER_ID>
<ORDER_NUMBER>10004434</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-387</CUST_PO_NUMBER>
<ORDER_LINE_ID>4579950</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>143949</INVENTORY_ITEM_ID>
<PART_NUMBER>779475-01</PART_NUMBER>
<PART_DESC>SCC-68 I/O CONNECTOR BLOCK WITH 4 SCC SIGNAL CONDITIONING MODULE SLOTS</PART_DESC>
<PART_CUSTOM_DESC>SCC-68, Screw Terminals</PART_CUSTOM_DESC>
<PLANNER_CODE>DAQH-MPS</PLANNER_CODE>
<HTS_CODE>8536.90.4000</HTS_CODE>
<TARIC_CODE>8536.90.1000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>144</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>10</ORIG_SHIP_QTY>
<UNIT_PRICE>144</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>144</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>10</SHIP_QTY>
<EXTENDED_PRICE>1440</EXTENDED_PRICE>
<UNIT_WEIGHT>1.06</UNIT_WEIGHT>
<NET_WEIGHT>10.6</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/01 NIC</WAYBILL>
<BREAKDOWN_COUNT>3</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>CD</COMPONENT>
<COMPONENT_DESC>Test1</COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>50</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2803.00.0050</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE>Test1</COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY>10</COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>Paper</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>20</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2839.90.0000</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>IP</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>1370</COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
<G_LINES>
<DELIVERY_ID>2629822</DELIVERY_ID>
<ORDER_HEADER_ID>1425429</ORDER_HEADER_ID>
<ORDER_NUMBER>10004365</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-372</CUST_PO_NUMBER>
<ORDER_LINE_ID>4579940</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>22643</INVENTORY_ITEM_ID>
<PART_NUMBER>777687-20</PART_NUMBER>
<PART_DESC>SCXI-1320 TEMPERATURE SENSOR TERMINAL BLOCK, CAST</PART_DESC>
<PART_CUSTOM_DESC>SCXI-1320, Screw Terminals</PART_CUSTOM_DESC>
<PLANNER_CODE>SCXIH-MPS</PLANNER_CODE>
<HTS_CODE>8536.90.4000</HTS_CODE>
<TARIC_CODE>8536.90.1000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>82</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>1</ORIG_SHIP_QTY>
<UNIT_PRICE>82</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>82</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>1</SHIP_QTY>
<EXTENDED_PRICE>82</EXTENDED_PRICE>
<UNIT_WEIGHT>.57</UNIT_WEIGHT>
<NET_WEIGHT>.57</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/02 NIC</WAYBILL>
<BREAKDOWN_COUNT>3</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>CD</COMPONENT>
<COMPONENT_DESC>Test1</COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>5</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2803.00.0050</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE>Test1</COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY>1</COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>Paper</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>2</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2839.90.0000</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>IP</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>75</COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
<G_LINES>
<DELIVERY_ID>2629822</DELIVERY_ID>
<ORDER_HEADER_ID>1427673</ORDER_HEADER_ID>
<ORDER_NUMBER>10004391</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-377</CUST_PO_NUMBER>
<ORDER_LINE_ID>4579948</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>143949</INVENTORY_ITEM_ID>
<PART_NUMBER>779475-01</PART_NUMBER>
<PART_DESC>SCC-68 I/O CONNECTOR BLOCK WITH 4 SCC SIGNAL CONDITIONING MODULE SLOTS</PART_DESC>
<PART_CUSTOM_DESC>SCC-68, Screw Terminals</PART_CUSTOM_DESC>
<PLANNER_CODE>DAQH-MPS</PLANNER_CODE>
<HTS_CODE>8536.90.4000</HTS_CODE>
<TARIC_CODE>8536.90.1000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>144</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>13</ORIG_SHIP_QTY>
<UNIT_PRICE>144</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>144</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>13</SHIP_QTY>
<EXTENDED_PRICE>1872</EXTENDED_PRICE>
<UNIT_WEIGHT>1.06</UNIT_WEIGHT>
<NET_WEIGHT>13.78</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/02 NIC</WAYBILL>
<BREAKDOWN_COUNT>3</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>CD</COMPONENT>
<COMPONENT_DESC>Test1</COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>65</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2803.00.0050</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE>Test1</COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY>13</COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>Paper</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>26</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2839.90.0000</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>IP</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>1781</COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
<G_LINES>
<DELIVERY_ID>2630021</DELIVERY_ID>
<ORDER_HEADER_ID>1429687</ORDER_HEADER_ID>
<ORDER_NUMBER>10004410</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-383</CUST_PO_NUMBER>
<ORDER_LINE_ID>4578220</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>61816</INVENTORY_ITEM_ID>
<PART_NUMBER>777687-14</PART_NUMBER>
<PART_DESC>SCXI-1314 FRONT MOUNTING TERMINAL BLOCK</PART_DESC>
<PART_CUSTOM_DESC>SCXI-1314, Screw Terminals</PART_CUSTOM_DESC>
<PLANNER_CODE>SCXIH-MPS</PLANNER_CODE>
<HTS_CODE>8536.90.4000</HTS_CODE>
<TARIC_CODE>8536.90.1000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>120</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>4</ORIG_SHIP_QTY>
<UNIT_PRICE>120</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>120</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>4</SHIP_QTY>
<EXTENDED_PRICE>480</EXTENDED_PRICE>
<UNIT_WEIGHT>.68</UNIT_WEIGHT>
<NET_WEIGHT>2.72</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/03 NIC</WAYBILL>
<BREAKDOWN_COUNT>3</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>CD</COMPONENT>
<COMPONENT_DESC>Test1</COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>20</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2803.00.0050</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE>Test1</COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY>4</COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>IP</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>452</COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE>HTS CODE</BREAKDOWN_TYPE>
<BREAKDOWN_VALUE>8536.90.4000</BREAKDOWN_VALUE>
<COMPONENT>Paper</COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE>8</COMPONENT_PRICE>
<COMPONENT_HTS_CODE>2839.90.0000</COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO>HU</COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
<G_LINES>
<DELIVERY_ID>2630054</DELIVERY_ID>
<ORDER_HEADER_ID>1435114</ORDER_HEADER_ID>
<ORDER_NUMBER>10004463</ORDER_NUMBER>
<CUST_PO_NUMBER>310986-396</CUST_PO_NUMBER>
<ORDER_LINE_ID>4580160</ORDER_LINE_ID>
<INVENTORY_ITEM_ID>96909</INVENTORY_ITEM_ID>
<PART_NUMBER>778729-01</PART_NUMBER>
<PART_DESC>NI PCI-4474, 4 INPUTS, 24-BIT DYNAMIC SIGNAL ACQUISITION</PART_DESC>
<PART_CUSTOM_DESC>PCI-4474, Automatic Data Processing Plug-In Board</PART_CUSTOM_DESC>
<PLANNER_CODE>INSTRHMPS</PLANNER_CODE>
<HTS_CODE>8471.80.4000</HTS_CODE>
<TARIC_CODE>8471.80.0000</TARIC_CODE>
<COUNTRY_OF_ORIGIN>HU</COUNTRY_OF_ORIGIN>
<ORDER_CURRENCY_CODE>USD</ORDER_CURRENCY_CODE>
<ORIG_UNIT_PRICE>960</ORIG_UNIT_PRICE>
<ORIG_SHIP_QTY>4</ORIG_SHIP_QTY>
<UNIT_PRICE>960</UNIT_PRICE>
<PRICE_CALC_STEP_NUMBER>100</PRICE_CALC_STEP_NUMBER>
<PRICE_CALC_CURRENCY_CODE>USD</PRICE_CALC_CURRENCY_CODE>
<PRICE_CALC_UNIT_PRICE>960</PRICE_CALC_UNIT_PRICE>
<PRICE_CALC_CONV_RATE>1</PRICE_CALC_CONV_RATE>
<SHIP_QTY>4</SHIP_QTY>
<EXTENDED_PRICE>3840</EXTENDED_PRICE>
<UNIT_WEIGHT>.68</UNIT_WEIGHT>
<NET_WEIGHT>2.72</NET_WEIGHT>
<ACQ_SOURCE_CODE></ACQ_SOURCE_CODE>
<ACQ_ORDER_NUMBER></ACQ_ORDER_NUMBER>
<ACQ_SOURCE_ORDER_NUMBER></ACQ_SOURCE_ORDER_NUMBER>
<ACQ_SELLING_PRICE>0</ACQ_SELLING_PRICE>
<SUBINVENTORY>NIEC Stage</SUBINVENTORY>
<SHIP_TO_SITE_USE_ID>807736</SHIP_TO_SITE_USE_ID>
<FREIGHT_COST>0</FREIGHT_COST>
<PAYMENT_TERMS>NIH InterCo</PAYMENT_TERMS>
<WAYBILL>901000598/04 NIC</WAYBILL>
<BREAKDOWN_COUNT>0</BREAKDOWN_COUNT>
<LIST_G_BREAKDOWN>
<G_BREAKDOWN>
<BREAKDOWN_TYPE></BREAKDOWN_TYPE>
<BREAKDOWN_VALUE></BREAKDOWN_VALUE>
<COMPONENT></COMPONENT>
<COMPONENT_DESC></COMPONENT_DESC>
<COMPONENT_CUSTOM_DESC></COMPONENT_CUSTOM_DESC>
<COMPONENT_PRICE></COMPONENT_PRICE>
<COMPONENT_HTS_CODE></COMPONENT_HTS_CODE>
<COMPONENT_TARIC_CODE></COMPONENT_TARIC_CODE>
<COMPONENT_COO></COMPONENT_COO>
<COMPONENT_QTY></COMPONENT_QTY>
</G_BREAKDOWN>
</LIST_G_BREAKDOWN>
</G_LINES>
</LIST_G_LINES>
</G_HEADER>
</LIST_G_HEADER>
</NI_COMMERCIAL_INVOICE_XMLP> -
Oracle 8i vs Oracle 9/10: Group by and order of returned rows
Hello people,
I've searched the forum for threads on this topic: the order of returned rows in queries which have a GROUP BY clause, and found out that Oracle states that GROUP BY clause does not guarantee that the order of returned rows will be the same every time nor the rows will be ordered someway. I've confirmed this information in the Oracle documentation for the GROUP BY clause for Oracle 9 and 10. But I couldn't find the same in the Oracle 8 documentation (SQL Reference), in which the GROUP BY clause section does not mention anything about the order of returned rows in queries which have a GROUP BY (except for something about using a GROUP BY and a HAVING clause together, which is not helpful in this situation).
Besides, I have an Oracle training book: "Introduction to Oracle: SQL and PL/SQL" for Oracle 8, where the GROUP BY clause is said to perform a default ordering, here is the text:
"By default, rows are sorted by ascending order of the columns included in the GROUP BY list. You can override this by using the ORDER BY clause".
So, I need to find out if Oracle 8 GROUP BY clause did some kind of sorting over the returned rows as it is said in the training book and if this behavior changed in Oracle 9. And more important: where to look for to find documentation about this change.
Thank you, guys, I really hope someone could help me with this.
Fer.And this statement from Tom (taken from the link above) says more about why the sort (even when done because of group by) should not be relied upon:
<quote from="asktom link above">
and even when it does sort as a by product of its processing, the sort is a
BINARY SORT, not your sort (with your language and character set)
</quote> -
3 Table Join with group by and order by clauses
I am porting from MySQL to Oracle 8i. I have a three Table Join in MySQL as follows:
select distinct TO_DAYS(l.listend)-TO_DAYS(NOW()) AS daysLeft, i.minbid, l.listend, i.itemid, i.itemtitle, l.listingid, l.lendstart, l.lendend, l.status, MAX(b.amount) AS curBid, COUNT(b.amount) AS numBids from TBL_ITEMS i, TBL_LISTING l LEFT JOIN TBL_BIDS b ON l.listingid=b.listingid where i.itemid = l.itemid AND l.status='1' AND (TO_DAYS(l.listend)-TO_DAYS(NOW()) >= 0) AND i.catcode LIKE'12__' GROUP BY listingid order by curBid DESC, daysLeft;
It performs an straight join on the first 2 tables (TBL_ITEMS and TBL_LISTING) and a LEFT JOIN between the previous result set and TBL_BIDS. TBL_BIDS uses a group by clause to obtain MAX and COUNT info. This final result set is the sorted (ORDER BY).
I have tried to reconstruct this type of call in Oracle and have failed. Several problems that I have notices: Oracle does not let me pull in additional columns when doing a GROUP BY clause.
(see below for my work around)
I have worked around the problem by creating a TABLE with the group by functionality and doing a straing 3 table join. (NOTE: I cannot create a view because use a LIKE function in the call... view dont have indexes). However, when I try to alias the column that returns DATE subtraction ("l.listend-TRUNC(SYSDATE) daysLeft" OR "l.listend-TRUNC(SYSDATE) dayLeft") I cannot use the LIKE statement.
Here is my question. How do I port the above 3-table MySQL call to Oracle. Why am I having these problems (is it the Oracle optimizer?) and how do I avaopid them in the future.
I really appreciate anyone's input. Thanks,
Inder
WORK AROUND:
FIRST STEP:
"create TABLE BIDSUM as
select l.listingid, COUNT(b.amount) numBids, MAX(b.amount) curBid from TBL_LISTING l, TBL_BIDS b where l.listingid=b.listingid(+) group by (l.listingid);"
NEXT STEP:
select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE), l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode LIKE '12%';
THIS ALSO WORKS (no LIKE):
"select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE) daysLeft, l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode='12'";
BUT THIS DOES NOT (alias the DATE arimetic)
select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE) daysLeft, l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode LIKE '12__';I am porting from MySQL to Oracle 8i. I have a three Table Join in MySQL as follows:
select distinct TO_DAYS(l.listend)-TO_DAYS(NOW()) AS daysLeft, i.minbid, l.listend, i.itemid, i.itemtitle, l.listingid, l.lendstart, l.lendend, l.status, MAX(b.amount) AS curBid, COUNT(b.amount) AS numBids from TBL_ITEMS i, TBL_LISTING l LEFT JOIN TBL_BIDS b ON l.listingid=b.listingid where i.itemid = l.itemid AND l.status='1' AND (TO_DAYS(l.listend)-TO_DAYS(NOW()) >= 0) AND i.catcode LIKE'12__' GROUP BY listingid order by curBid DESC, daysLeft;
It performs an straight join on the first 2 tables (TBL_ITEMS and TBL_LISTING) and a LEFT JOIN between the previous result set and TBL_BIDS. TBL_BIDS uses a group by clause to obtain MAX and COUNT info. This final result set is the sorted (ORDER BY).
I have tried to reconstruct this type of call in Oracle and have failed. Several problems that I have notices: Oracle does not let me pull in additional columns when doing a GROUP BY clause.
(see below for my work around)
I have worked around the problem by creating a TABLE with the group by functionality and doing a straing 3 table join. (NOTE: I cannot create a view because use a LIKE function in the call... view dont have indexes). However, when I try to alias the column that returns DATE subtraction ("l.listend-TRUNC(SYSDATE) daysLeft" OR "l.listend-TRUNC(SYSDATE) dayLeft") I cannot use the LIKE statement.
Here is my question. How do I port the above 3-table MySQL call to Oracle. Why am I having these problems (is it the Oracle optimizer?) and how do I avaopid them in the future.
I really appreciate anyone's input. Thanks,
Inder
WORK AROUND:
FIRST STEP:
"create TABLE BIDSUM as
select l.listingid, COUNT(b.amount) numBids, MAX(b.amount) curBid from TBL_LISTING l, TBL_BIDS b where l.listingid=b.listingid(+) group by (l.listingid);"
NEXT STEP:
select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE), l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode LIKE '12%';
THIS ALSO WORKS (no LIKE):
"select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE) daysLeft, l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode='12'";
BUT THIS DOES NOT (alias the DATE arimetic)
select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE) daysLeft, l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode LIKE '12__'; -
GROUP BY and ORDER BY help needed
I have got an sql query where I have the need to pull out the latest copy of duplicate info, but what is happening is that the first instance is being displayed. The query I have is this:
SELECT *
FROM tbl_maincontenttext
WHERE fld_menusection = 3
GROUP BY fld_webpage
ORDER BY fld_timedate DESC
Basically, I have content that is listed under menu section 3, but within that I will have several copies of content that will relate to a specific webpage (eg: about us). What is currently happening is that GROUP BY is obviously grouping the similarly named 'about us', but it is pulling the first record it comes across out of the database rather than the latest updated record.
As you can see, I am trying to get the query to order by fld_timedate which is a CURRENT_TIMESTAMP, but it's not working!
I'm hoping that there is some sort of SQL that I am unaware of that will help me group by and display the latest update/content.
Thanks.
MatIt would help if you could show us the table definition. Your SQL statement is ambigous because you are selecting all table columns, yet only including one column in the group by clause. A SQL statement must contain all selected columns that are not aggregates. Most DBMS will return an error for this statement. Others that don't return an error will return unexpected results.
-
Date_format, group by and order by together
Hi,
SELECT
T.foreign_network_id as "Network ID",
date_format(T.ARRIVAL_DATE,'%v-%x') as "Date",
sum(case when((networks_rejected = 0)
and (T.sor_reapply = 'N')
and (T.sor_reason in ('NP', 'NU', 'NT', 'HT')))
then T.CNT else 0 end) as "Before Steering",
sum(case when(sor_reason in ('NP', 'HT', 'T2', 'TM', 'NM', 'MM', 'IPMM', 'NPMM'))
then T.CNT else 0 end) as "After Steering"
FROM ST_INC T,
NETWORKS N,
ZONE_NW_MAP ZN,
ZONES Z,
PAYMENT_TYPE PT
WHERE T.FOREIGN_NETWORK_ID = N.NETWORK_ID
AND ZN.NETWORK_ID = N.NETWORK_ID
AND Z.ZONE_ID = ZN.ZONE_ID
AND PT.id = T.ptype
AND opcode = 2
AND sor_action is not null
and Z.ZONE_ID = 269
group by
date_format(T.ARRIVAL_DATE,'%v-%x'),
T.foreign_network_id
order by date_format(T.ARRIVAL_DATE,'%v-%x')
Above code works but it orders malfunctionally. It orders as if the week-day combination is a string not a date.
I want:
09.2009
10.2009
02.2010
03.2010
06.2011
It outputs:
02.2010
03.2010
06.2011
09.2009
10.2009
I know that the problem arises from the "order by" part. When I call the function date_format I guess a different data type is returnd thus the result is not achieved as intended. So I thought of changing that part only making last line order by T.ARRIVAL_DATE. It worked fine in mysql however it gave error in oracle. This is the error:
ORA-00979: not a GROUP BY expression
00979. 00000 - "not a GROUP BY expression"
When I replace all "date_format(T.ARRIVAL_DATE,'%v-%x')" s with "T.ARRIVAL_DATE" it works fine again. However this is not what i wanted. I want to see the results in the format I gave and group with respect to that fomat, additionally ordering them chronologically. How is that possible?Frank Kulash wrote:
Hi,
baydinfb wrote:
Hi,
SELECT
T.foreign_network_id as "Network ID",
date_format(T.ARRIVAL_DATE,'%v-%x') as "Date",
sum(case when((networks_rejected = 0)
and (T.sor_reapply = 'N')
and (T.sor_reason in ('NP', 'NU', 'NT', 'HT')))
then T.CNT else 0 end) as "Before Steering",
sum(case when(sor_reason in ('NP', 'HT', 'T2', 'TM', 'NM', 'MM', 'IPMM', 'NPMM'))
then T.CNT else 0 end) as "After Steering"
FROM ST_INC T,
NETWORKS N,
ZONE_NW_MAP ZN,
ZONES Z,
PAYMENT_TYPE PT
WHERE T.FOREIGN_NETWORK_ID = N.NETWORK_ID
AND ZN.NETWORK_ID = N.NETWORK_ID
AND Z.ZONE_ID = ZN.ZONE_ID
AND PT.id = T.ptype
AND opcode = 2
AND sor_action is not null
and Z.ZONE_ID = 269
group by
date_format(T.ARRIVAL_DATE,'%v-%x'),
T.foreign_network_id
order by date_format(T.ARRIVAL_DATE,'%v-%x')
Above code works but it orders malfunctionally. It orders as if the week-day combination is a string not a date. Apparantly, date_format returns a string, similar to how TO_CHAR in Oracle returns a string. To verify this, create a view where one on the columns is the results of date_format, and then describe that view.
I want:
09.2009
10.2009
02.2010
03.2010
06.2011
It outputs:
02.2010
03.2010
06.2011
09.2009
10.2009
I know that the problem arises from the "order by" part. When I call the function date_format I guess a different data type is returnd thus the result is not achieved as intended. So I thought of changing that part only making last line order by T.ARRIVAL_DATE. It worked fine in mysql however it gave error in oracle. This is the error:
ORA-00979: not a GROUP BY expression
00979. 00000 - "not a GROUP BY expression"
When I replace all "date_format(T.ARRIVAL_DATE,'%v-%x')" s with "T.ARRIVAL_DATE" it works fine again. However this is not what i wanted. I want to see the results in the format I gave and group with respect to that fomat, additionally ordering them chronologically. How is that possible?I don't know about yur database, but in Oracle you can "GROUP BY t.arrival_date", and still use expressions like "TO_CHAR (t.arrival_date, ...)" in the SELECT clause. Then, if you say "ORDER BY t.arrival_date" it will sort by the arrival_date column in the table, even if the alias "arrival_date" is used for something else.
Using scott.emp to illustrate:
SELECT TO_CHAR (e.hiredate, 'fmMonth YYYY') AS hiredate
, e.hiredate AS raw_date
FROM scott.emp e
GROUP BY e.hiredate
ORDER BY hiredate -- This means the result set column called "HIREDATE"
, e.hiredate -- This means the table column called "HIREDATE"
;Output:
HIREDATE RAW_DATE
April 1981 02-Apr-1981 00:00:00
April 1987 19-Apr-1987 00:00:00
December 1980 17-Dec-1980 00:00:00
December 1981 03-Dec-1981 00:00:00
February 1981 20-Feb-1981 00:00:00
February 1981 22-Feb-1981 00:00:00
January 1982 23-Jan-1982 00:00:00
June 1981 09-Jun-1981 00:00:00
May 1981 01-May-1981 00:00:00
May 1987 23-May-1987 00:00:00
November 1981 17-Nov-1981 00:00:00
September 1981 08-Sep-1981 00:00:00
September 1981 28-Sep-1981 00:00:00Notice how, within a month (e.g. February 1981) the rows are sorted by DATE.Thanks for the answers, I tried, no errors but there is a problem with the requirements. Correct me if I am wrong.
I can use the expression with "date_format" or "to_char" in select clause and then group by the actual date field. But this does not include all I want. When I formatted a date column as "week-year" such as 09.2010 I also meant to group by according to that format. In your solution totally same dates are grouped together but I want to be able to have that same weeks(no need to have same days) are grouped or even same months are grouped by and then order by actual date.
Edited by: baydinfb on Aug 27, 2010 2:13 PM -
Using group by and searching with in a group
I am looking for a way to group results in a table, then compare the results with in each group.
Here is some example data.
cid--eid--gid--seqid
101--m123--g123--111
100--m123--g123--111
102--m123--g123--111
200--m124--g124--211
201--m124--g124--211
202--m124--g124--210
300--m125--g223--311
301--m125--g223--311
302--m125--g223--311
303--m125--g223--311
400--m125--g223--411
401--m125--g223--411
402--m125--g223--411
403--m125--g223--411
403--m125--g223--412
If I group by eid, gid and order by cid I would get the following
Group 1:
101--m123--g123--111
100--m123--g123--111
102--m123--g123--111
Group 2:
200--m124--g124--211
201--m124--g124--211
202--m124-g124---210
Group 3:
300--m125--g223--311
301--m125--g223--311
302--m125--g223--311
303--m125--g223--311
Group 4:
400--m125--g223--411
401--m125--g223--411
402--m125--g223--411
403--m125--g223--411
403--m125--g223--412
Now I need to find out the cids in each group for which the seqid is NOT matching with majority in the group. For example, I need the output as
cid--eid--gid--seqid
202--m124--g124--210
403--m125--g223--412
What are the ways to do the above? One way I think is to use a temp table, but given the size of the table that may not be a possibility
Please let me know how to do thiswith sample_table as (
select 101 cid,'m123' eid,'g123' gid,111 seqid from dual union all
select 100,'m123','g123',111 from dual union all
select 102,'m123','g123',111 from dual union all
select 200,'m124','g124',211 from dual union all
select 201,'m124','g124',211 from dual union all
select 202,'m124','g124',210 from dual union all
select 300,'m125','g223',311 from dual union all
select 301,'m125','g223',311 from dual union all
select 302,'m125','g223',311 from dual union all
select 303,'m125','g223',311 from dual union all
select 400,'m125','g223',411 from dual union all
select 401,'m125','g223',411 from dual union all
select 402,'m125','g223',411 from dual union all
select 403,'m125','g223',412 from dual
select cid,
eid,
gid,
seqid
from (
select cid,
eid,
gid,
seqid,
seqid_cnt,
max(seqid_cnt) over(partition by grp) max_cnt
from (
select cid,
eid,
gid,
seqid,
grp,
count(*) over(partition by grp,seqid) seqid_cnt
from (
select s.*,
cid - row_number() over(partition by eid,gid order by cid) grp
from sample_table s
where seqid_cnt != max_cnt
CID EID GID SEQID
202 m124 g124 210
403 m125 g223 412
SQL> SY. -
Iterating through List View Items using Group By and Jquery
In my listview to my document library, I am using grouping. For each group (using month), it lists all the documents pertaining to that particular month.
Using JQuery, I need to go through each item and parse them, but I'm having trouble finding a usable selector for the for/each function. My parsing code (JQuery) works, but since it uses the class of the table cell with a child anchor, it basically
finds the first item and then all the subsequent file names are named the same (instead of different names, like it should be).
Here's my current code that doesn't work (only the iteration and naming separately for each file - the parsing I'm doing seems to work):
$(".ms-wpContentDivSpace" ).each(function( index ) {
var val=$(".ms-vb2 a").html();
var val2=val.replace(/_/g," ");
$(".ms-vb2 a").html(val2);
any ideas?That's because
$(".ms-vb2 a").
is bringing back all the pieces that have that class with an anchor on the whole page, not just the ones in the .ms-wpContentDivSpace
I don't know the exact syntax, but I think you need to iterate through all the '.ms_vb2 a' items as well - there are multiple ones, and do something like this inside your other grouping
$(".ms-vb2 a").each(function(index) {
var val=$(this).html();
var val2=val.replace(/_/g," ")
$(this).html(val2);
That's not quite right but maybe that will help.
Robin -
Cannot query using both conforming and cached query result
TopLink doesn't allow me to both use conforming and cached query result at the same time.
Conforming is certainly not a superset of the [cached query result] features.
Can you confirm that it's a limitation of TopLink?
Any know workaround to end-up with the same features as using both conforming and cached query result?
Conforming is about seeing modifications you do in the same transaction. As a bonus, if you query for one object and specify at least the id as criteria because TopLink will have to check in memory anyway it can avoid going to the database.
But if I do a query like "give me employees hired before now and after 30 days ago" it's about more than one objects and about finding existance so cached query result is needed to get acceptable performance in a complex application trying to avoid the same SQL generated over and over again.Thats where the trace just ends? It doesnt look like there's any LIKE or filtering going on (with respect to the Oracle pieces anyway), apparently MSAccess simply requested the whole table.
What do you mean by 'hang' exactly? Are you sure it's just not taking a long time to complete? How long have you waited? How fast does it complete on the other environment?
ODBC tracing isnt likely to help much for that. SQLNet tracing would be better to see what is going on at a lower level. Specifically, what is going on at the network level? Is the client waiting for a packet to be returned from the database?
Is the database having a hard time processing the query, perhaps due to index/tuning issues?
Assuming that is indeed the query that is "hung", how much data does that return?
Are you able to reproduce the same behavior with that query and vbscript for example?
Greg
Maybe you are looking for
-
P45D3 Platinum And G.Skill 4GB Dual Kit DDR3-1333 F3-10666C FREEZE!? HELP!
Hi there! First sorry bout my bad english! I bought yesterday the new p45d3 platinum mainboard and g.skill 4GB Dual Kit DDR3-1333 F3-10666C memory and i have this same problem that seems to be popular. The Bios works fine, but when installing xp sp
-
How to configure the iphone for zimbra mail? have anyone used zimbra mail in iphone mail settings? I'm able to access zimbra through safari... But what is the configuration needed to be done to see in mail box?
-
All my photo libraries in my iPhone have duplicate photos since I have installed IOS 6. I work with Aperture 3.3 not iPhoto! Also, most of the photos in my camera library have been deleted without my consent! I'm very ****** about that! Please help.
-
Weird screen doing stuff itself
iPad 2 from october '11 First few months were fine other than magnet in screen cover thing messing with orientation when I turned the screen. Took it off and I was happy. It works now. But the new issue Is that the extreme right part of my screen som
-
Cannot make Bumblebee (systemd-logind failed)
I had bought an Dell Inspiron 14 notebook and now I'm now I'm trying to use Arch Linux, but I can't make the graphic interfaces work. I'm getting continuosly this error, [ERROR]Cannot access secondary GPU - error: [XORG] (EE) systemd-logind: failed t