Nested queries
I have this nested queryy but technology does not produce results as it should. The nested query works fine because I've alerted the values on, but I can't get the nested values to be written in the html code. Here is the code:
tx.executeSql("select eventdate,strftime('%m',eventdate) as month, strftime('%Y',eventdate) as year from news where flag in ('E','A') and eventdate > '2011-7-6' group by date(eventdate,'start of month','+1 month','-1 day') having eventdate is not null order by date(eventdate,'start of month','+1 month','-1 day')", [], function(tx,rs){ if(rs.rows.length > 0){ for(var i=0;i'+app.getMonthName(row.month)+" "+row.year+' '; //alert(row.month+" "+row.year) tx.executeSql("select subject,strftime('%m',eventdate) as month, strftime('%w',eventdate) as day from news where strftime('%m',eventdate) = strftime('%m','"+row.eventdate+"') and strftime('%Y',eventdate) = strftime('%Y','"+row.eventdate+"') and flag in ('E','A') order by eventdate", [], function(tx,rs2){ //alert(rs2.rows.length); for(var p=0;p'+app.getMonthName(row2.month)+" "+row2.day+' '+row2.subject+' ' ; } } , app.onError); } }//end for loop*/ showresultDiv.innerHTML += contentDiv+''; } } , app.onError);
Please can anyone help with this.
Realizing the nature of the html5 application I decide not not my app like that. I made sure, after the main title are built I use an OnClick event to call a function that forwards the relevant data for me to make a dropdown menu with all the values that I needed to be out all at once on the charge.
Tags: BlackBerry Developers
Similar Questions
-
Nested queries in Apex/BEEP Source?
With the help of Apex 4.0.2.00.07, I have a master report / detail required that has a rather long header/footer and then lots of detail rows. The ideal ratio would eventually something like the following:
Paragraphs in header information
Line 1
....
Line 100
Info from footer paragraph
Is it possible for the Apex report queries to generate the XML to nest queries? I know that I can throw it all in a single record by joining tables, but then I have to generate all the header information for each line instead of once for each master record. I know that BEEP can handle it because I can do it for EBS by defining relationships of the query in the definition of data, but I can't seem to find a way to do it in the Apex report query. I've seen several comments on this issue, but no definitive answer. If anyone can help, I'd appreciate it.
Jessica,
You can not. If you decide to put all the data in a single line, you can build your model to break in the header data. The other option is to generate the report in the Pub BI and then call the report using webservice api bi pub.
Introduction to the Web Services BI Publisher - 11g Release 1 (11.1.1)
-
combinations, nested queries
Hello everyone,
We need to change technologies according to the needs of the company and we would like to understand request.
Select t1.fld1 as class, v2.section, v1.duration,
rownum, nest queries, dot operator and combinations make us confused.
T1.fld2 as start_date, end_date as t1.fld3,
(t1.fld2 + v2.section - 1) as sectiondate
Of
(select Fld1 as class, ((fld3-fld2) + 1) as the length)
from t1
) v1
, (select rownum as object section where rownum < 180) v2
t1
where t1.fld1 = v1.class
and v2.section < = v1.duration
We need help with this.
Thanks in advance,
NYHello
I don't have your question. In your request, that you do not use one of the columns object, you simply use a virtual column rownum to get an output of 180 lines with value 1-179. This array with the value 1 to 179 you set v2 table in your SQL.
Concerning
-
XML not nested queries return no line plus
Hello
I have an urgent problem concerning the following:
I've migrated the XMLDB queries below 11.2.0.1 to 11.2.0.3I registered just the schema
() DBMS_XMLSCHEMA.registerSchema
SCHEMAURL = > ' http://www.mywebsite.com/XML/Impex/order/2006-10-31 ',
SCHEMADOC = > bfilename ('XMLDIR', 'order.xsd'),
local = > TRUE,
gentypes = > TRUE,
gentables = > TRUE,
CSID = > nls_charset_id ('AL32UTF8'));
COMMIT;
Some query works correctly and others not more are:
Queries that do not work are those referring to XML elements nested as in "QUERY 2" belowI think I missed a few steps of initialization for XMLDB.
Order.xsd is the same in both cases
SQLTypes and collections air well (they were created.
(Do not know gentables = > TRUE is necessary in creating schema)Please give some feedback soon.
Thank you very much in advance.In the following XML_FILE is XMLTYPE
QUERY 1
SELECT THIS WORKS PROPERLY--------------------------------
SELECT
ORDER_LEVEL1.order_no,
TO_TIMESTAMP (ORDER_LEVEL1.order_date, ' YYYY-MM-DD "T" HH24:MI:SS.ff3 "Z" "").
ORDER_LEVEL1.created_by, ORDER_LEVEL1.currency, ORDER_LEVEL1.customer_locale, ORDER_LEVEL1.order_status
Of
p (selection double XML_FILE),
XMLTable)
xmlnamespaces (default 'http://www.mywebsite.com/xml/impex/order/2006-10-31'),
' / orders/order "ADOPTION p.XML_FILE
COLUMNS
The "@order-no"order_no WAY,
ORDER_DATE PATH "order date"
created_by PATH "created by",
currency of access road "currency."
customer_locale "client-local," PATH
order_status PATH "order status/tracking".
) ORDER_LEVEL1;
-----------------------------------
QUERY 2
THIS SELECTION IS NOT WORKING NOW (returns the LINES No.)
--------------------------------
Select
order_no as order_no, STOREID as STOREID, SHIPPINGMETHOD as SHIPPINGMETHOD
Of
(
with mainq as
(
Select
ORDER_LEVEL1.order_no as ORDER_NO,
CUSTOMATT_LEVEL2.*
Of
p (selection double XML_FILE),XMLTable)
xmlnamespaces (default 'http://www.mywebsite.com/xml/impex/order/2006-10-31'),
' / orders/order "ADOPTION p.XML_FILE
COLUMNS
The "@order-no"order_no WAY,
custom_attribute PATH of XMLTYPE "custom-attributes/custom-attribute.
) ORDER_LEVEL1,.XMLTable (xmlnamespaces (default 'http://www.mywebsite.com/xml/impex/order/2006-10-31'), )
"/ custom attribute" ADOPTION ORDER_LEVEL1.custom_attribute
COLUMNS
attribute_id PATH ' @attribute-id ',
path value 'value '.
) CUSTOMATT_LEVEL2
)
Select
order_no,
STOREID, Max (decode(attribute_id,'storeId',TheValue)),
Max (decode(attribute_id,'shippingMethod',TheValue)) SHIPPINGMETHOD
of mainq
Order_no group
);ORDER FOR REFERENCE. XSD (only the rΘation segment to the elements in the query)
< xsd: element name = "orders" xdb:defaultTable = "ORDERS" >
< xsd: complexType mixed = "false" xdb:SQLType = "DMW_ORDERS" xdb:maintainDOM = "false" >
< xsd: SEQUENCE >
< xsd: element name = "command" type = "complexType.Order" xdb:SQLCollType = "DMW_ORDERS_COLL" minOccurs = "0" maxOccurs = "unbounded" > < / xsd: element > "
< / xsd: SEQUENCE >
< / xsd: complexType >
< / xsd: element >
< xsd: complexType name = "complexType.Order" xdb:SQLType = "DMW_ORDER" xdb:maintainDOM = "false" > "
< xsd: SEQUENCE >
< xsd: element name = "order date" type = "xsd: DateTime" minOccurs = "1" maxOccurs = "1" xdb:SQLType = "TIMESTAMP WITH TIME ZONE" >
< xsd: annotation >
< xsd: documentation > original date and time, the order was placed. < / xsd: documentation >
< / xsd: annotation >
< / xsd: element >
< xsd: element name = "created by" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "original-order-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "currency" type = "simpleType.Currency" maxOccurs = "1" minOccurs = "1" > < / xsd: element > "
< xsd: element name = "customer-local" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "source code" type = "complexType.SourceCode" maxOccurs = "1" minOccurs = '0' > < / xsd: element > "
< xsd: element name = "name-partner-affiliation" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "partner-affiliate-id" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "invoice-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "customer" type = "complexType.Customer" maxOccurs = "1" minOccurs = "0" > "
< xsd: annotation >
< xsd: documentation > information about the customer who placed the order. < / xsd: documentation >
< / xsd: annotation >
< / xsd: element >
< xsd: element name = "customer-order-reference" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "status" type = "complexType.OrderStatusSet" maxOccurs = "1" minOccurs = "0" > "
< xsd: annotation >
< xsd: documentation > Order status information. < / xsd: documentation >
< / xsd: annotation >
< / xsd: element >
< xsd: element name = "replace-code" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "description to replace" type = "simpleType.Generic.String.4000" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "replacement-order-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "replaced-order-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "current-order-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "cancel-code" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "cancel-description" type = "simpleType.Generic.String.4000" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "LineItem-product" type = "complexType.ProductLineItems" maxOccurs = "1" minOccurs = "0" > "
< xsd: annotation >
< xsd: documentation > product line items of the order. < / xsd: documentation >
< / xsd: annotation >
< / xsd: element >
< xsd: element name = "LineItem-giftcertificate" type = "complexType.GiftCertificateLineItems" maxOccurs = "1" minOccurs = '0' > < / xsd: element > "
< xsd: element name = "transport-LineItem" type = "complexType.ShippingLineItems" maxOccurs = "1" minOccurs = '0' > < / xsd: element > "
< xsd: element name = "expeditions" type = "complexType.Shipments" maxOccurs = "1" minOccurs = "0" > "
< xsd: annotation >
< xsd: documentation > shipments of the command. < / xsd: documentation >
< / xsd: annotation >
< / xsd: element >
< xsd: element name = "totals" type = "complexType.OrderTotals" maxOccurs = "1" minOccurs = "0" > "
< xsd: annotation >
< xsd: documentation > order total. < / xsd: documentation >
< / xsd: annotation >
< / xsd: element >
< xsd: element name = "payments" minOccurs = "0" maxOccurs = "1" type = "complexType.Payments" >
< xsd: annotation >
< xsd: documentation > payments used for the order. < / xsd: documentation >
< / xsd: annotation >
< / xsd: element >
< xsd: element name = "remoteHost" type = "simpleType.Generic.String.40" minOccurs = "0" maxOccurs = "1" / > "
< xsd: element name = "notes" type = "complexType.Notes" minOccurs = "0" maxOccurs = "1" / > "
< xsd: element name = "external-order-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "external-order tracking" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "external-order-text" type = "simpleType.Generic.String" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
< xsd: element name = "custom attributes" type = "sharedType.CustomAttributes" minOccurs = "0" maxOccurs = "1" / > "
< / xsd: SEQUENCE >
< xsd: attribute name = "order-no" type = "simpleType.Generic.String.256" use = "required" / > "
< / xsd: complexType >.......................
< xsd: complexType name = "sharedType.CustomAttributes" mixed = "false" xdb:SQLType = "DMW_CUSTOMATTRIBUTES" xdb:maintainDOM = "false" > "
< xsd: SEQUENCE >
< xsd: element name = "custom, the attribute" type = "sharedType.CustomAttribute" minOccurs = "0" xdb:SQLCollType = "DMW_CUSTOMATTRIBUTES_COLL" maxOccurs = "unbounded" / > "
< / xsd: SEQUENCE >
< / xsd: complexType >.......................
< xsd: complexType name = "sharedType.CustomAttribute" mixed = "true" xdb:SQLType = "DMW_CUSTOMATTRIBUTE" xdb:maintainDOM = "false" > "
< xsd: SEQUENCE >
< xsd: element name = "value" type = "simpleType.Generic.String" minOccurs = "0" maxOccurs = "unbounded" / > "
< / xsd: SEQUENCE >
< xsd: attribute name = "id attribute" type = "simpleType.Generic.NonEmptyString.256" use = "required" / > "
< xsd: attribute ref = "XML: lang" / >
< / xsd: complexType >-XML (partial segment) example
<? XML version = "1.0" encoding = "UTF-8"? "> < ordered xmlns ="http://www.mywebsite.com/xml/impex/order/2006-10-31">."
< order order-no = "BLY0000001605" >
< - > 2014 order date - 02-25T 11: 00:30.959Z < / date of order >
ECOMMERCE < created-by > < / created by >
BLY0000001605 < original-order - No. > < / original-order-not >
< currency > $ < / currency >
<>client-local en_US < / customer-local >
< status >
Placed > order tracking < < / order >
< / status >
< custom attributes - >
< attribute custom attribute id = "storeId" > < value > < / value > < / custom attribute >
< attribute custom attribute id = "shippingMethod" > < value > SAMEDAY_DLV < / value > < / custom attribute >
< / custom attributes >
< / order >
< / order >I can't believe it. You are right.
Removed the external selection and it worked! Mysteries of the Oracle :-)
Thank you so much Odie
(just a question: is 63 your favorite number or your birth year? you can answer me separately if you like...)
GP_63
-
nesting queries on multiple sql files - possible?
Hello
I was wondering if the following would be possible, and if so what the syntax in sqlplus?
Imagine I have a query that generates a table of data output. I can then refer to it and affix analytical functions on this one in a separate sql file?
For example if I have the query:
AB.sql
I could this split into two files sql A and B?select count (*) from (select sysdate from dual)
A.SQL
B.SQLselect sysdate from dual
the result of the execution of B.sql would be 1.select count (*) from @C:\A.sql
for now I really wonder if this is doable on a conceptual level, anyone know?
Thank you
JonYes, on the conceptual level, it is possible.
cat a.sql select count (*) from ( @b.sql ) ; cat b.sql select sysdate from dual sqlplus scott SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 12 13:13:58 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> set echo on SQL> @a.sql SQL> select count (*) 2 from ( 3 @b.sql 3 select sysdate from dual 4 ) 5 ; COUNT(*) ---------- 1
Best regards
Maxim
-
Using the cursor to another (nested cursors) cursor objects...?
Now, I'm pretty sure that's not possible, but as a last thought of the station, it would not hurt to ask.
I have a number of fairly complex cursors in PL/SQL (all beautifully packaged upwards), which are used in a number of other different queries for reporting. Because the same cursor is reused several times in different contexts, I want set the cursor once, then use it as a subquery in the other queries. This will also help as if I place the SQL directly in other queries, then it will be necessary propagate the changes to the base query in all other queries which use - and that it will be maintained by a large team that goes forward, it would be wide open to things being missed... (not that I don't trust my colleagues or anything like that...!)
So, in brief and simple terms, if I;
CURSOR curDateList (pi_start_date AS, pi_end_date IN DATE)
IS
SELECT pi_start_date + rownum - 1 when
FROM (select '1' sys.dual connects by level < = (pi_end_date - pi_start_date + 1));
that returns a list of the dates of pi_start_date to pi_end_date, and I want to integrate in another slider like;
CURSOR curEmpWork (pi_start_date AS, pi_end_date IN DATE)
IS
SELECT e.employee_id, dl.when, e.work_pattern
OF e xxx.emp_work_patterns,.
DL curDateList (pi_start_date, pi_end_date)
WHERE dl.when = e.roster_date
ORDER BY e.roster_date;
(Needless to say that queries are much more complex and many!)
I reached the required result by using the pipeline table functions that just open the first cursor and run each line, but am frequently end up using multiple nested functions to achieve and I see marked in this way, then the performance degradation that comes to nest queries within the other runs a lot faster. As a nested query is just a nested cursor, it seems that this is possible, but I'm not only have no chance - I am struggling to find something that says that it of possible or not (which made me think I am barking the wrong tree here!)
Any help would be greatly appreciated.No, it is not possible, but have you thought of creating a view instead?
-
Pivot gives invalid identifier query
I am trying to create my first pivot query. I have two tables:
CREATE TABLE "SKIP"."ORDERS" ( "CATG" VARCHAR2(30), "PART_NR" VARCHAR2(30), "PART_REV" VARCHAR2(30), "CUST_ID" NUMBER, "ORDER_DT" DATE ) ; CREATE TABLE "SKIP"."CUSTOMERS" ( "STATE" VARCHAR2(30), "CUST_ID" NUMBER ) ;
I want to create a PivotTable with years above and some of the numbers on the side. I had a problem from the beginning when I tried it. It seems that you can't use a function on the clause, which forbids me to use
PIVOT (COUNT (PART_NR) to extract (year of the ORDERS.) ORDER_DT))
I don't remember the exact error, he gave me, but I found a "possible solution" with the query nested that I have below
SELECT * FROM (SELECT PART_NR, YR FROM ( (SELECT ORDERS.CATG || '-' || ORDERS.PART_NR || ORDERS.PART_REV AS PART_NR, extract (year from ORDERS.ORDER_DT) AS "YR" FROM ORDERS, CUSTOMERS where CUSTOMERS.STATE = "VA" and ORDERS.CUST_ID = CUSTOMERS.CUST_ID ) ) PIVOT (COUNT(PART_NR) FOR YR IN ( 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ) ) ) ORDER BY PART_NR
But now, I get an error: 'Year': invalid identifier
I tested the two nested queries (beginning with SELECT PART_NR, YR OF) and who did indeed get the two columns PART_NR and year, so the problem must be in the PIVOT.
Any ideas?
Hello
You probably mean COUNT (*) instead of COUNT (part_nr) and use SELECT * in the subquery, which is the PIVOT.
There is a column called GOING? If this isn't the case, you probably want to single quotes, not double - quote, in line 6.
2 external queries can be combined; You can make an ORDER BY in the query even as PIVOT.
If I had copies of sample size of your tables, and the results you wanted Sinc sample data, then I could test and show you exactly.
Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.
Also post the results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: https://forums.oracle.com/message/9362002
-
Hi guys.
I tried to summarize a bunch of lines, but I got a bit doing wrong.
I have a few nested queries that I show below:
SELECT DATA, SAP, SADIG, DIFF FROM (SELECT TMPSAP.DATSAP as DATA, TMPSAP.VALSAP as SAP, TMPSADIG.VALSADIG as SADIG, ABS(TMPSAP.VALSAP - TMPSADIG.VALSADIG) as DIFF, GROUPING(TMPSAP.DATSAP) AS GRUPO FROM (SELECT SUM(ZVLBRT) + SUM(ZDESVP) as VALSAP, TO_DATE(SPTAG, 'YYYYMMDD') as DATSAP FROM SAPR3.S974@PRD WHERE VKORG = '1000' AND (TO_NUMBER(SPART) BETWEEN 10 AND 55 OR SPART = '99') AND KUNNR <> 1004 AND TO_DATE(SPTAG, 'YYYYMMDD') BETWEEN TRUNC(TRUNC(SYSDATE, 'DD') - 1, 'MM') AND TRUNC(SYSDATE, 'DD') - 1 GROUP BY SPTAG) TMPSAP, (SELECT SUM(FATDEVVLR) as VALSADIG, DATFATDEV as DATSADIG FROM SADIG_FATDEV WHERE BUCDG = 01 AND DATFATDEV BETWEEN TRUNC(TRUNC(SYSDATE, 'DD') - 1, 'MM') AND TRUNC(SYSDATE, 'DD') - 1 GROUP BY DATFATDEV) TMPSADIG WHERE TRUNC(TMPSAP.DATSAP, 'DD') = TRUNC(TMPSADIG.DATSADIG, 'DD') GROUP BY GROUPING SETS((DATSAP, VALSAP, VALSADIG),())) ALLDATA GROUP BY ROLLUP(ALLDATA.GRUPO, ALLDATA.DATA, SAP, SADIG, DIFF)
I will have some difficulties to determine which GROUP BY attributes should I use for the outter request, so the results I get are like these:
DATA SAP SADIG DIFF 08/01/2013 1000 2000 1000 08/01/2013 1000 2000 08/01/2013 1000 08/01/2013 08/02/2013 1000 1000 0 08/02/2013 1000 1000 08/02/2013 1000 08/02/2013 08/03/2013 2000 3000 1000 08/03/2013 2000 3000 08/03/2013 2000 08/03/2013 08/05/2013 5000 5000 0 08/05/2013 5000 5000 08/05/2013 5000 08/05/2013 08/06/2013 1000 2000 1000 08/06/2013 1000 2000 08/06/2013 1000 08/06/2013 If you look at my second selection layer (the one that returns ALLDATA), my results are like these:
DATA SAP SADIG DIFF GRUPO 08/01/2013 1000 2000 1000 0 08/02/2013 1000 1000 0 0 08/03/2013 2000 3000 1000 0 08/05/2013 5000 5000 0 0 08/06/2013 1000 2000 1000 0 1 And what I want is this:
DATA SAP SADIG DIFF 08/01/2013 1000 2000 1000 08/02/2013 1000 1000 0 08/03/2013 2000 3000 1000 08/05/2013 5000 5000 0 08/06/2013 1000 2000 1000 10000 13000 3000 I tried several combinations in the rollup PACKAGE, but without success. What Miss me?
Thank you very much!
Best regards
Vinicius
WITH just STEP_3 simulates the result of your step_3. For brevity, I've coded dates as strings.
Use only the part colored on my previous post.
Concerning
Etbin
better yet
with
STEP_3 as
(select to_date (' 01/08/2013 ',' dd/mm/yyyy') DATA, SAP 300, SADIG 100, 200 DIFF 0 GRUPO of union double all the)
Select to_date (February 8, 2013 ', ' dd/mm/yyyy'), 1000,1000,0, 0 of all the double union
Select to_date (March 8, 2013 ',' dd/mm/yyyy ""), - 500,-500, 0, 0 of all the double union
Select to_date (May 8, 2013 ', ' dd/mm/yyyy'), 5000,5000,0, 0 of all the double union
Select to_date (June 8, 2013 ', ' dd/mm/yyyy'), 1200,1200,0, 0 of all the double union
Select to_date (July 8, 2013 ', ' dd/mm/yyyy'), 1800,1800,0, the double 0
)
Select decode data (grouping (data), 0, to_char(data,'dd/mm/yyyy'),'Total:');
Sum (SAP) sap,
Jeremy Sum (Sadig),
Sum (diff) diff
of step_3
Group of rollup (data)
Post edited by: Etbin used dates
-
one-to-many selfjoin, delete records with the same rank or a substitution
Sorry for my poor choice of the title of the discussion, feel free to suggest me a more relevant
I rewrote for clarity and as a result of the FAQ post.
Version of DB
I use Oracle10g Enterprise 10.2.0.1.0 64-bit
Tables involved
CREATE TABLE wrhwr ( wr_id INTEGER PRIMARY KEY, eq_id VARCHAR2(50) NULL, date_completed DATE NULL, status VARCHAR2(20) NOT NULL, pmp_id VARCHAR2(20) NOT NULL, description VARCHAR2(20) NULL);
Examples of data
INSERT into wrhwr VALUES (1,'MI-EXT-0001',date'2013-07-16','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (2,'MI-EXT-0001',date'2013-07-01','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (3,'MI-EXT-0001',date'2013-06-15','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (4,'MI-EXT-0001',date'2013-06-25','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (5,'MI-EXT-0001',date'2013-04-14','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (6,'MI-EXT-0001',date'2013-04-30','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (7,'MI-EXT-0001',date'2013-03-14','Com','VER-EXC','Collaudo')
Query used
SELECT * FROM (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Verifica%') table1, (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Revisione%') table2, (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Collaudo%') table3 WHERE table1.eq_id = table3.eq_id AND table2.eq_id = table3.eq_id AND table1.eq_id = table2.eq_id
The above query is intended to selfjoin wrhwr table 3 times in order to have for each line:
- eq_id;
- date of the completion of a verification type work request for this eq_id (aka table1);
- date completion of a line (aka table2) type wr for this eq_id;
- date of completion of a type wr Collaudo (aka table3) for this eq_id;
A separate eq_id:
- can have different completion of many requests for work (wrhwr records) with dates or date of completion (date_completed NULL column).
- in a date range can have all types of wrhwr ('verification', 'Line', 'Problem'), or some of them (e.g. audit, line but not Collaudo, Collaudo but not verification and line, etc.);
- must not repeat the substrings in the description;
- (eq_id, date_completed) are not unique but (eq_id, date_completed, description, pmp_id) must be unique;
Expected results
Using data from the example above, I expect this output:
eq_id, table1.date_completed, table2.date_completed, table3.date_completed
MI-ext-001,2013-07-01,2013-07-16,2013-03-14 <- to this eq_id table3 doesn't have 3 lines but only 1. I would like to repeat the value most in the rankings in table 3 for each line of output
MI-ext-001,2013-07-01,2013-06-15,2013-03-14 <-I don't want this line of table1 and table2 with both 3 lines match must be in terms of grade (1st, 1st) (2nd, 2nd) (3rd, 3rd)
MI-ext-001,2013-06-25,2013-06-15,2013-03-14 <-2nd table1 joined the 2nd row from table2
MI-ext-001,2013-04-30,2013-04-14, 2013-03-14 <-1 table1, table2 rank rank 1, 1st rank table3
In the syntax of vector style, tuple expected output should be:
IX = ranking of the i - th of tableX
(i1, i2, i3) IF EXISTS a rank i - th line in each table
ON THE OTHER
(i1, b, b)
where b is the first available lower ranking of the table2, or NULL if there isn't any line of lower rank.
Clues?
With the query, I am unable to delete the lines "spurius.
I think a solution based on analytical functions such as LAG() and LEAD(), using ROLLUP() or CUBE(), using nested queries, but I would find a solution elegant, simple, fast, and easy to maintain.
Thank you
Hello
Sorry, it's still not quite clear what you are asking.
This becomes the desired resutls of the sample data you posted:
WITH got_r_type AS
(
SELECT eq_id, date_completed
CASE
Description WHEN LIKE '% Collaudo %' THEN 'C '.
Description WHEN AS 'Line %' THEN 'R '.
Description WHEN AS 'Verification %' THEN 'V '.
END AS r_type
OF wrhwr
Situation WHERE! = s "
AND pmp_id LIKE '% WORM - EX'
)
got_r_num AS
(
SELECT eq_id, date_completed, r_type
, ROW_NUMBER () OVER (PARTITION BY eq_id, r_type)
ORDER BY date_completed DESC NULLS LAST
) AS r_num
OF got_r_type
WHERE r_type IS NOT NULL
)
SELECT eq_id
LAST_VALUE (MIN (CASE WHEN r_type THEN date_completed END = ' V')
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS audit
LAST_VALUE (MIN (CASE WHEN r_type = 'R' THEN date_completed END)
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS line
LAST_VALUE (MIN (CASE WHEN r_type = 'C' THEN date_completed END)
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS collauda
OF got_r_num
GROUP BY eq_id
r_num
ORDER BY eq_id
r_num
;
I guess the description can have (at most) only substrings target, in other words, you can't have a line like this:
INSERT into (1,'MI-EXT-0001',date'2013-07-16','Com','VER-EXC','Revisione VALUES wrhwr and audit");
In addition, you said the combination (eq_id, date_comepleted) is not unique, that it is y no example of this in your sample data. What results would you if, in addition to this line (who did the validation):
INSERT into wrhwr VALUES (7,'MI-EXT-0001',date'2013-03-14','Com','VER-EXC','Collaudo');
the following line is also?
INSERT into wrhwr VALUES (97,'MI-EXT-0001',date'2013-03-14','Com','VER-EXCFUBAR','Collaudo');
.
You could do a self-join instead of GROUP BY, but I suspect it will be much less effective. You can use FULL OUTER JOIN, since you do not know what r_types was that r_nums.
-
Hi, im sure that someone probably will this quickly.
IM generate xml in oracle, one of the nested queries is similar to this...
but for some reason any in my dissertation to result the order of the questions are always messed up, is there a way to keep the order of attribute?select test1 ,test2 , xmlelement ( "QUESTION" , xmlattributes ( question_n as "question_number",question as "question_t") ) AS Xt1 FROM myview_VW
I tried an order around here, but this query is nested in many others. as I said, that basically, I just want to keep the order.
I know that I do not understand any of the construction code, if necessary, I'llselect test1 ,test2 , xmlelement ( "QUESTION" , xmlattributes ( question_n as "question_number",question as "question_t") ) AS Xt1 order by question_n FROM myview_VW
Thank youJay wrote:
Thanks BluShadow - but that removed a whole level which I can't do.Why? Put a different output?
In your example, LEVEL1 and LEVEL2 can be combined in a single subquery, this is what BluShadow done to simplify the query and then apply the command without having to go QUESTION_NUMBER to the next level.If she asks problem in your real cases, keep the levels they are now and just add the ORDER BY clause if necessary.
If you choose to do, you go QUESTION_NUMBER level 1 or 2:... level_1 as (select top1 , top2 , dt , question_number , xmlelement ( "QUESTION" , xmlattributes ( question_number as "question_number",question as "question_text" ) ) AS X1 FROM vtesting ) , LEVEL_2 AS ( select top1,top2,dt , Xmlelement ( "SURVEY" , xmlattributes ( dt as "date" ) , xmlagg ( x1 ORDER BY to_number(question_number)) ) as x2 FROM LEVEL_1 GROUP BY top1,top2,dt ) ...
-
Come selects (two or more) virtual Tables Possible?
Hello.
That's what I mean by a virtual table - and it works in OBIEE-
However, this does not work-select saw_0, saw_2, saw_3 from ( SELECT "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number saw_0, "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Order_Creation_Date saw_2, "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Order_Closed_Date saw_3 FROM "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service" WHERE "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number BETWEEN '100000' AND '100009' ) t1
[Note that each of the nested queries works well on its own.]
My question is this - y at - it a syntactic variation on what works? Or is it impossible?select saw_0, saw_2, saw_3, saw_4 from ( (SELECT "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number saw_0, "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Order_Creation_Date saw_2, "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Order_Closed_Date saw_3 FROM "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service" WHERE "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number BETWEEN '100000' AND '100009' ) t1, (SELECT TOPN("- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number, 3) saw_4, FROM "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service" WHERE "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number BETWEEN '100000' AND '100009' ) t2 ) t3
Thank you!
CharlieHi Charlie,
Select this check box under query, I suggest you to make example which can help you to understand my approach.
I used the quarter column because it is close to your condition, thereby, I see 4 times each files instead of 3 as in your example.SELECT A.saw_1, A.saw_2
Of
(SELECT
Time. "" Saw_0 of the year. "
Time.Quarter saw_1,
'Sales' saw_2
OF "SubjectArea.
WHERE the time. "' Year ' = '2012'
ORDER BY saw_0, saw_1) a RIGHT OUTER JOIN
(SELECT time. "' Year ' saw_0, rcount (Time.Quarter) saw_1 OF THE time WHERE"SubjectArea. ("' Year ' = '2012') B
ON (A.saw_0 = B.saw_0)For values of rehearsal go to the properties of the column-> column-> value remove Format-> repeat
Hope this helps you.
-
step to create object VO 2 of 9
Hi experts jdev,.
uses 11.1.1.5.0 - adfbc jdev
I try to create new vo.
and by giving his name amd select readonly access via the sql query.
and I put this query.
while I'm clicking the Query Builder:SELECT level1, level2, level3, level4, acct, acct_desc, DECODE (SIGN (SUM (acct_bal)), 1, SUM (acct_bal), 0) db_amt, DECODE (SIGN (SUM (acct_bal)), 1, 0, -1 * SUM (acct_bal)) cr_amt FROM ( SELECT gayb_lvl1 level1, gayb_lvl2 level2, gayb_lvl3 level3, gayb_lvl4 level4, gayb_acct acct, (SELECT glal_desc1 FROM gl_lvl_accounts,gl_acct_yearly_bal WHERE glal_bu=:p_bu and glal_bu= GAYB_BU AND glal_lvl1=gayb_lvl1 AND glal_lvl2=gayb_lvl2 AND glal_lvl3 = gayb_lvl3 AND glal_lvl4 = gayb_lvl4 AND glal_acct=gayb_acct AND glal_plant = GAYB_PLANT AND glal_plant = :p_plant ) acct_desc, gayb_opbal acct_bal FROM gl_acct_yearly_bal WHERE gayb_bu = :p_bu AND gayb_year = :p_year AND gayb_opbal <> 0 AND GAYB_PLANT = :p_plnt AND ( SELECT DISTINCT glal_opt_type FROM gl_lvl_accounts WHERE glal_bu = :p_bu AND glal_plant = :p_plnt AND glal_lvl1 = gayb_lvl1 AND glal_lvl2 = gayb_lvl2 AND glal_lvl3 = gayb_lvl3 AND glal_lvl4 = gayb_lvl4 AND glal_acct = gayb_acct) = :p_opt_type AND gayb_lvl1 || gayb_lvl2 || gayb_lvl3 || gayb_lvl4 || gayb_acct NOT IN ( SELECT GLAL_LVL1|| GLAL_LVL2|| GLAL_LVL3 || GLAL_LVL4 || GLAL_ACCT FROM gl_lvl_accounts WHERE GLAL_BU = :p_bu AND GLAL_PLANT = :P_PLNT and GLAL_STATUS='A' AND :p_opt_type IN('M','I') AND glal_opt_type IN ('M','I') ) UNION SELECT gapb_lvl1 level1, gapb_lvl2 level2, gapb_lvl3 level3, gapb_lvl4 level4, gapb_acct acct, (SELECT glal_desc1 FROM gl_lvl_accounts,gl_acct_yearly_bal WHERE glal_bu=:p_bu and glal_bu= GAYB_BU AND glal_lvl1=gayb_lvl1 AND glal_lvl2=gayb_lvl2 AND glal_lvl3 = gayb_lvl3 AND glal_lvl4 = gayb_lvl4 AND glal_acct=gayb_acct AND glal_plant = GAYB_PLANT ) acct_desc, SUM (gapb_debit_amt - gapb_credit_amt) acct_bal FROM gl_acct_periodic_bal WHERE gapb_bu = :p_bu AND gapb_year = :p_year AND gapb_period <= :p_to AND GAPB_PLANT = :p_plnt AND (SELECT DISTINCT glal_opt_type FROM gl_lvl_accounts WHERE glal_bu = gapb_bu AND glal_plant = :p_plnt AND glal_lvl1 = gapb_lvl1 AND glal_lvl2 = gapb_lvl2 AND glal_lvl3 = gapb_lvl3 AND glal_lvl4 = gapb_lvl4 AND glal_acct = gapb_acct) = :p_opt_type AND gapb_lvl1 || gapb_lvl2 || gapb_lvl3 || gapb_lvl4 || gapb_acct NOT IN ( SELECT GLAL_LVL1|| GLAL_LVL2|| GLAL_LVL3 || GLAL_LVL4 || GLAL_ACCT FROM gl_lvl_accounts WHERE GLAL_BU = :p_bu AND GLAL_PLANT = :P_PLNT and GLAL_STATUS='A' AND :p_opt_type IN('M','I') AND glal_opt_type IN ('M','I')) GROUP BY gapb_lvl1, gapb_lvl2, gapb_lvl3, gapb_lvl4, gapb_acct HAVING SUM (gapb_debit_amt - gapb_credit_amt) <> 0 UNION SELECT gapb_lvl1 level1, gapb_lvl2 level2, gapb_lvl3 level3, gapb_lvl4 level4, gapb_acct acct, (SELECT glal_desc1 FROM gl_lvl_accounts,gl_acct_yearly_bal WHERE glal_bu=:p_bu and glal_bu= GAYB_BU AND glal_lvl1=gayb_lvl1 AND glal_lvl2=gayb_lvl2 AND glal_lvl3 = gayb_lvl3 AND glal_lvl4 = gayb_lvl4 AND glal_acct=gayb_acct AND glal_plant = GAYB_PLANT ) acct_desc, SUM (gapb_debit_amt - gapb_credit_amt) acct_bal FROM gl_acct_periodic_bal WHERE gapb_bu = :p_bu AND gapb_year = :p_year AND gapb_period <= :p_to AND GAPB_PLANT = :p_plnt AND (SELECT DISTINCT glal_opt_type FROM gl_lvl_accounts WHERE glal_bu = gapb_bu AND glal_plant = :p_plnt AND glal_lvl1 = gapb_lvl1 AND glal_lvl2 = gapb_lvl2 AND glal_lvl3 = gapb_lvl3 AND glal_lvl4 = gapb_lvl4 AND glal_acct = gapb_acct) = :p_opt_type AND gapb_lvl1 || gapb_lvl2 || gapb_lvl3 || gapb_lvl4 || gapb_acct NOT IN ( SELECT GLAL_LVL1|| GLAL_LVL2|| GLAL_LVL3 || GLAL_LVL4 || GLAL_ACCT FROM gl_lvl_accounts WHERE GLAL_BU = :p_bu AND GLAL_PLANT = :P_PLNT and GLAL_STATUS='A' AND :p_opt_type IN('S') AND glal_opt_type IN ('S')) GROUP BY gapb_lvl1, gapb_lvl2, gapb_lvl3, gapb_lvl4, gapb_acct HAVING SUM (gapb_debit_amt - gapb_credit_amt) <> 0) GROUP BY level1, level2, level3, level4, acct, acct_desc
Error analysis of declarative query nested queries does not currently include the union, intersector less.
but I can't able to move forward. ? and when run the sqlplus query means query is good. no problem with that.while I'm clicking the test button: the query is valid.
can someone tell me.
What is happening. ?
Why requires resources. am in need if the Union or union all.
Please someone clarify this.The query designer will not work with the union and a few other advanced stuff, always the vo and the query will work.
Timo
-
Hello
This has been driving me crazy! I want to display all the parts that have the same production, based on the following query:
< name cfquery = 'Hand' datasource = 'Parts' username = "admin" password = "XXXXX" >
SELECT Main_Table.Image_File, Main_Table.Part_Number, Contract_Table.Name_of_Contract, Main_Table.Quantity,
Main_Table.Specific_Description, Nomen_Table.Generic_Nomen, MNFR_Table.Manufacture_Name,
Vendor_Table.Vendor_Name, Main_Table.NEMS_Tag, Main_Table.Location
Vendor_Table INNER JOIN (Nomen_Table INNER JOIN (MNFR_Table INNER JOIN (Contract_Table INNER JOIN Main_Table ON Contract_Table.Contract_num = Main_Table.Contract_num) WE MNFR_Table.MNFR_num = Main_Table.MNFR_num) WE Nomen_Table.Nomenclature_ID = Main_Table.Nomen_num) ON Vendor_Table.Vendor_num = Main_Table.Vendor_num
WHERE (((Main_Table.MNFR_num) = #form.mnfr_lst #) AND ((Main_Table.Contract_num) = [Contract_Table]!) [Contract_num]) AND ((Main_Table.MNFR_num) = [MNFR_Table]! [MNFR_num]) AND ((Main_Table.Nomen_num) = [Nomen_Table]! [Nomenclature_ID]) AND ((Main_Table.Vendor_num) = [Vendor_Table]! [Vendor_num])) < / cfquery >
It uses an Access database. (You can see the relationship of table here: http://spacecoasthomes.net/relation.jpg )
However, when I view the page, I get cases of duplicated data. (Check it out on my test server, http://devo.dns2go.com/ )
Select Hewlett Packard as the manufacter. It should return only 3 parts. However, it is to repeat the following fields:
Main.Part_Number, Main.Quantity, Main.NEMS_Tag, Main.Specific_Description and Main.Location.
Here is the table that I use to display the data:
< table border = "0" cellpadding = "15" cellspacing = "0" bgcolor = "FFFFFF" >
< cfoutput query = 'Hand' >
< cfif Main.currentrow mod 3 eq 1 >
< b >
< / cfif >
< td >
< p > < cfoutput > < img src = "" images / #Main.Image_File # "width ="150"> < / cfoutput > < / p >"
< p > < span class = "style1" > part number: </span > < cfoutput > < span class = "style1" > < cfoutput > #Main.Part_Number # < / cfoutput > < / span > < / cfoutput > < br / >
< span class = "style1" > contract: </span > < cfoutput > < span class = "style1" > #Main.Name_of_Contract # </span > < / cfoutput > < br / >
< span class = "style1" > </span > quantity: cfoutput > < cfoutput > < span class = "style1" > #Main.Quantity # </span > < / cfoutput > < / cfoutput > < br / >
< span class = "style1" > specific Description: </span > < cfoutput > < cfoutput > < span class = "style1" > #Main.Specific_Description # </span > < / cfoutput > < / cfoutput > < br / >
< span class = "style1" > Nomenclature: </span > < cfoutput > < span class = "style1" > #Main.Generic_Nomen # </span > < / cfoutput > < br / >
< span class = "style1" > manufacturer: </span > < cfoutput > < span class = "style1" > #Main.Manufacture_Name # </span > < / cfoutput > < br / >
< span class = "style1" > main provider: </span > < cfoutput > < span class = "style1" > #Main.Vendor_Name # </span > < / cfoutput > < br / >
< span class = "style1" > NEMS Tag: </span > < cfoutput > < cfoutput > < span class = "style1" > #Main.NEMS_Tag # </span > < / cfoutput > < / cfoutput > < br / >
< span class = "style1" > location (Cage/rank): cfoutput > < cfoutput > #Main.Location # < / cfoutput > < / cfoutput > < / span > < br / >
< /p > < table >
< cfif Main.currentrow mod 3 eq 0 >
< /tr >
< / cfif >
< / cfoutput >
< /table >
I know that the dataset is correct because I tested the return dataset (using the < cfdump var = "#Main #" >) that checks the correct data (you can see here):
( http://spacecoasthomes.net/dataset.jpg )
I tried many different forms of the same query, nested queries and joins. Any help would be appreciated to grealty!
Eric
Problem has been resolved. For the benefit of others reading this thread, here's what happened:
The changes to the SQL by Dan Bracuk (thanks!)
Everything isn't the problem, it makes it easier to follow.The problem is in the display table code. Look at the original code:
Part Number:
#Main.Part_Number #
Contract:#Main.Name_of_Contract #
Quantity:#Main.Quantity #
Specific description:#Main.Specific_Description #
Nomenclature:#Main.Generic_Nomen #
Manufacturer:#Main.Manufacture_Name #
Main provider:#Main.Vendor_Name #
NEMS Tag:#Main.NEMS_Tag #
Location (Cage/line):#Main.Location #
Look at all those
tags! No wonder it was the impression of duplicate fields. Redid the code and works fine! Necessary only a set of these tags for all of the outputs.
Corrected following code:
Part Number: #Main.Part_Number #
Contract: #Main.Name_of_Contract #
Quantity: #Main.Quantity #
Specific description: #Main.Specific_Description #
Nomenclature: #Main.Generic_Nomen #
Manufacturer: #Main.Manufacture_Name #
Main provider: #Main.Vendor_Name #
NEMS Tag: #Main.NEMS_Tag #
Location (Cage/line): #Main.Location #.
Thank you!
Eric
-
How to write queries nested using the DB adapter?
I want to write a request nested by using the help DB adapter box...
SELECT INVOICE_ID, FILE_NAME IN BILLING_INVOICE_PDF_V where FILE_ID =)
(SELECT MAX (FILE_ID) FROM BILLING_INVOICE_PDF_V WHERE (INVOICE_ID = '12345'))) ;
Thank you
RAM.
Hi Ram,
It's probably the semicolon at the end of the SQL statement that causes the db adapter for error; Simply enter the SQL custom without a semicolon at the end.
SELECT INVOICE_ID, FILE_NAME IN BILLING_INVOICE_PDF_V where FILE_ID = (SELECT MAX (FILE_ID) OF BILLING_INVOICE_PDF_V WHERE INVOICE_ID = '12345')
-
Queries nested SQLPlus can be imported in Discoverer?
I have a query that contains a subquery and I was wondering if somehow I can import into Discoverer. I tried, but it fails with: parsing failed due to fatal errors - error: features not supported for analytical expressions.
Or discoverer has a problem with the CASE and how I use it?
Here is the code I am trying to import:
Select Assoc., customer, name,
Retail_Plan, Run_Date,
Check_Date, sum (Checks), "Active_EE_Here,"
Sum (Retail_Amt), sum (Discount_Amt), sum (Retail_Net),
Sum (Payroll_Fees), sum (Delivery_Fee).
Sum (HR_Fees), sum (Setup_Fee)
FROM (Select cm.associate_no Assoc,
cm.client_no customer,
cm.client_name name,
CBL.retail_plan,
CBL.run_date Run_Date,
Check_Date CBL.check_date,
CASE WHEN cb.fee_code = 2
CBL.check_count END THEN, checks
"Active_EE_Here,"
Sum (CB.retail_amount) Retail_Amt,
Sum (CB.retail_disc_amount) Discount_Amt,
Sum (CB.retail_net_amount) Retail_Net,
WHEN CM BOX. FREQUENCY = 1
THEN the sum *.37 (cb.retail_amount)
OTHER amount (cb.retail_amount) *.22 END Payroll_Fees.
CASE WHEN cb.fee_code = 5000
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 5010
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 5012
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 5014
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 5015
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 5016
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 5017
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 5018
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 5019
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 8000
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 8001
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 8002
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 8003
THEN sum (cb.retail_amount)
WHEN cb.fee_code = 8004
THEN sum (cb.retail_amount) END Delivery_Fee,
Sum (CB.retail_net_amount)-
(CASE WHEN CM. FREQUENCY = 1
THEN the sum *.37 (cb.retail_amount)
OTHER amount (cb.retail_amount) *.22 END) HR_Fees,.
CASE WHEN cb.fee_code = 9997
THEN sum (cb.retail_amount) END Setup_Fee
of ap.mstr cm, ap.clt_bill cbl, cb ap.bill
where cm.pclient_id = cbl.pclient_id
and ((cbl.pclient_id = cb.pclient_id))
and (cb.bill_year = 2009
and cb.bill_month = 3)
and (cm.associate_no = 23)
and (cbl.bill_year = 2009
and cbl.bill_month = 3)
Group of cm.associate_no, cm.client_no, cm.client_name, cbl.retail_plan, cbl.run_date, cbl.check_date, cb.fee_code, CM. FREQUENCY, cbl.check_count)
GROUP BY Assoc, Client, name, Retail_Plan, Run_Date Check_Date, 7, 8
order by 1, 2, 3, 4, 5
OLIVIER Descoverer Desktop version 10.1.2.1
Oracle Database EE 10g 10.2.0.3 Release
Thanks for the advice offered,
Gary F.
Published by: Gary F on March 31, 2009 15:39Hello
You will not be able to import this SQL using office, but you should be able to create a custom folder that contains the SQL by using discoverer Administration. Have you tried?
Rod West
Maybe you are looking for
-
Last night, I installed the full version of the Sierra and then this morning to the dismay, found that QuickBooks 2015 is not compatible with the Sierra. So, rather than be forced to move as my QB files online for a monthly fee or pay another $200 to
-
Unable to backup iPhone for iMac
I try to do a backup on my account through my iMac iTunes, but get an error code. 'Failed attempt to copy the disk "MacIntosh HD". An unknown error has occurred. -(54) ' I need to back up my phone to trade it for a new.» I have updated my iPhone a
-
visa resources Finder will find PXI-4070
Hello I use LV 2015, 32-bit on windows 7 x 64. I have an SMU-1065 OR connected to the PCI computer bus. I have several instruments in the PXI chassis included some switch cards, a scope and a PXI-4070 DMM. When I run the VISA resource finder, the r
-
Disc SimX 2nd flight does not load.
Cannot get the 2nd disc of FSX to load. Firstly a load always... ill put a 2nd in and nothing. The game has resumed the first time, thinking it was a damaged drive. New game I got the same thing, with no problem, 2nd 1st will not charge. What is the
-
IF I TRY AND OPEN, VIEW, DELETE, DOWNLOAD, WHATEVER. I GET A MSG OF ERROR THAT SAYS THAT THE FILE IS NOT AN ASSOCIATION TO PERFORM THE TASK AND TO SET FILE ASSOCIATIONS IN THE PANEL. \THIS IS NOT TRUE AND EVERYTHING? I CAN'T DO A SYSTEM RESTORE YE