Group by, order by
I've created a custom item type, and the associated funciton to format it.
I can use the custom search applet to display the subsets of items that I want, but I'd like to sort by one of the attributes (authors last name) and group by another (year).
Failing that I'd like the standard two item sort. Is there a way to do this with the custom search applet, if not what's the best approach to this requirement
Portal search doesn't support multiple ordering attributes at the moment, although it is being considered for a future release.
Similar Messages
-
What are the key fields used to group double orders in t-code SDD1?
What are the key fields used to group double orders in t-code SDD1?
Cheers,
VTHi,
You can group the duplicate sales documents with the help of the following fields,
Sold-To-Party,Document type,date and sales area details.
Regards,
Gopal. -
Use Handling Units to group production orders?
Hello,
can I use Handling Units to group production orders together? We have a workcenter where all our orders go through and we'd like to group, say, the morning's orders in a single HU on which we could post a single transaction (batch?) instead of posting on each and every order.
Thanks,
JonathanPlease check OSS note 793168.
-
XK03 can be restricted by account group in order to prevent general users
Hello Gurus,
Please advise, if XK03 can be restricted by account group in order to prevent general user population from displaying employee data ?
I understand that XK03 has auth object F_LFA1_GRP for account group in which I restricted with 03 and particular account groups but still the test is failing because the test user is able to view employee data.
Please suggest..
Regard's
SalmanHi Alex,
Thank you !
By your last update, do you mean auth group or account group? If you are talking about auth group then this auth object F_LFA1_BEK (XK03) has auth group.
I checked the F_LFA1_GRP is active in SU24. Is there something which i need to look in F_LFA1_BEK for particular auth group after restricting the auth object F_LFA1_GRP with account group ?
Thank you for your valuable suggestions
Regard's
Salman -
Hi all,
I have a table name as angdata77 having attributes like asigno..
i want to retrieve data from angdata77 by using both group by & order by clauses.. for total count..
am using the query as
select asigno,count(*) from angdata77 group by asigno order by asigno;
Is there any other query for retrieving the data from angdata77
Thanks in Advance,
Venkatesh J.885756 wrote:
Ya it's good.. Performance also good while retrieving data...
I want to know other Possibilities also sir...There will be no better alternative for this, because this is the most simple and straight forward way to get the output you are looking for..
Go ahead without any confusion... :) -
EA1 - SQL Formatter issues (JOINs and GROUPs and ORDER BY oh my ;)
Great job with improving the SQL Formatter, but it still has some bugs that need to be worked out.
The key words JOIN and it's modifiers INNER, LEFT, RIGHT and FULL OUTER are not recognized as master key words. As such they end up flush against the left margin Also when GROUP BY and/or ORDER BY key words are present in an outer most select statement the other key words are not indented far enough to be right aligned with the end of the word BY and are indented too far to be right aligned with the word GROUP or ORDER. In sub queries, GROUP and ORDER BY are correctly right aligned with their respective SELECT statements.We're picking up and collating the Formatter issues. I'll add these.
Specific bug for these #7013462
Sue -
Problem with group by/order by clause when using huge data
Hi,
I'm using below query on my table of size more than 210 million rows.
SELECT booking_date FROM T_UTR
WHERE four_eyes_status = 'A' AND booking_date <= '01-jul-2005' AND booking_date >= '01-jan-2004'
AND invoice_id IS NULL AND link_id = 12345
AND billing_indicator = 'L'
GROUP BY booking_date ORDER BY booking_date
If I'm skipping last line "GROUP BY booking_date ORDER BY booking_date", its giving me immediate result, but, because of group by/order by, the query may take 30 seconds to 2 minutes based on the data fetched for the date range. It may vary from 2 to 2 million rows, & grouping by for so many rows at run time will automatically take some time.
Here I want to know, is there any procedure in oracle(any function based index) so that I can store/retrieve distinct values for link_id, & booking_date without grouping them at run time. Or the performance of the query can be increased
Thanks
DeepakHi,
You can use Materialized Views as stated earlier - specifically by using Query Rewrite. If the conditions on columns "four_eyes_status", "invoice_id", and "billing_indicator" never change in your query - then you can create a Materialized View that is targeted for those conditions and has lower cardinality (since you aren't grouping by those columns). The "COUNT(*)" allows the use of the DISTINCT operator in addition to "GROUP BY' as well for Query Rewrite.
Create the Materialized View like this:
CREATE MATERIALIZED VIEW test_mv1
BUILD IMMEDIATE
USING NO INDEX
REFRESH FORCE ON DEMAND
ENABLE QUERY REWRITE
AS
SELECT booking_date
, link_id
, COUNT(*) AS count_star
FROM T_UTR
WHERE four_eyes_status = 'A'
AND invoice_id IS NULL
AND billing_indicator = 'L'
GROUP BY booking_date
, link_id ;To improve performance further - create an index on the "LINK_ID" column like this:
CREATE INDEX test_mv1_link_id_idx
ON test_mv1 (link_id);Then - gather stats immediately on the Materialized View so that the CBO can use it for rewriting your original query - like this:
BEGIN
DBMS_STATS.gather_table_stats (ownname => USER
, tabname => 'TEST_MV1'
, partname => NULL
, estimate_percent => DBMS_STATS.auto_sample_size
, block_sample => FALSE
, method_opt => 'FOR ALL COLUMNS SIZE 1'
, degree => NULL
, granularity => 'ALL'
, cascade => TRUE
, no_invalidate => FALSE
END;
/Now - the CBO should be able to rewrite your original query to use the Materialized View - provided you set up your session for Query Rewrite like this:
ALTER SESSION SET query_rewrite_enabled = TRUE;
ALTER SESSION SET query_rewrite_integrity = ENFORCED; -- set this to whatever staleness you can tolerate - see the docs for details...Now - after setting up your session - try running your query with autotrace to see if it was rewritten...
Good luck!
Message was edited by:
PDaddy -
Getting first row in a group by order by sql
Hi all,
I'm having problems with the query below. What I want is to get a count of hotelid and group it then take the top result. My problem is that the version of oracle that I'm using is giving me errors because of the nested group by, order by. Is there any way around this?
SELECT *
FROM (SELECT agentid, hotelid, COUNT(hotelid) AS COUNT
FROM akorders a, akworklist_summary b
WHERE a.agentid = 1408946 AND
a.akorderid = b.akorderid
GROUP BY agentid, hotelid
ORDER BY COUNT DESC)
WHERE ROWNUM < 2
TIA!
BrianSELECT agentid, hotelid, COUNT(hotelid) AS COUNT
FROM akorders a, akworklist_summary b
WHERE a.agentid = 1408946 AND
a.akorderid = b.akorderid
GROUP BY agentid, hotelid
HAVING COUNT(*) = (SELECT MAX(icount)
FROM (SELECT agentid, hotelid, COUNT(hotelid) AS icount
FROM akorders a, akworklist_summary b
WHERE a.agentid = 1408946 AND
a.akorderid = b.akorderid
GROUP BY agentid, hotelid )) -
GROUP BY & ORDER BY in a Report
How to Implement GROUP BY & ORDER BY in a Report?
Hi,
Order by: It is possible to sort the char value according to the values (asc or desc) of an atribute of this char...is this what you were looking for?
Group by: May be can be achieved by drilldwon sequence, with the grouping char to the left of the char values to be grouped...again, is this what you had in mind? -
Add new payment group to order.
I want to add extra payment group to order.I can use order.addpaymentgroup and addrelationship.is this right approach?
I read somewhere it's not good approach to add relationship this way.
Please ssuggest how can i add new payment group to order.You dont need to create the relationship explicitly. OrderManager, PaymentGroupManager, CommerceItemManager etc gives some method to support split payment groups and that will create the relationship.
For example, in case if you want to use half of the order amount to one Payment Group called PG1 and remaining to PG2, you can use the below approach.
OrderManager.addOrderAmountToPaymentGroup(Order, PG1.id (payment group id), amount), this method will create a relationship and assign the amount to that payment group.
Next, you need to set the remaining amount to PG2,
OrderManager.addRemainingItemAmountToPaymentGroup(Order, PG2.id), this will add the remaining amount to PG2 and create the relationship.
Similiar methods are available in the manager classes mentioned above, check API docs for details.
Cheers
R -
Can group print orders ( example various greeting card designs) to one shipment
I recently ordered two types of greeting cards within minutes from each others. They were handled and shipped separately. One has arrived the other hasn't. Does iPhoto have a shopping cart type of feature ( like many others do) This way I can group my orders into one shipment ( 2 books, various size prints, greeting cards )
No. Only multiple copies of the same item are shipped together. The two different card types constitute two different orders and must be shipped separately.
OT -
Internal Order Group & Internal order wise report
Hi All
Any Standard reports are available to display the internal order group name and internal order.
Any Standard Function module or standard table are available to retrieve the order group and internal order details.
Please confirm.
Regards
K.GunasekarHi,
There is a lot of standard reports (e.g. S_ALR_87012993 - Orders: Actual/Plan/Variance); just go to Information systems of the Internal orders in the standard menu.
Tables: AUFK - orders master data. SETNODE and SETLEAF - groups.
Regards,
Eli -
Count(*) in a analytic situation with group by order by
Hello every body,
I have a count(*) problem in an sql with analytics function on a table
when I want to have all his column in the result
Say I have a table
mytable1
CREATE TABLE MYTABLE1
MY_TIME TIMESTAMP(3),
PRICE NUMBER,
VOLUME NUMBER
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.01.664','DD-MM-YY HH24:MI:SS:FF3' ),49.55,704492 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.02.570','DD-MM-YY HH24:MI:SS:FF3' ),49.55,705136 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.31.227','DD-MM-YY HH24:MI:SS:FF3' ),49.55,707313 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.31.227','DD-MM-YY HH24:MI:SS:FF3' ),49.55,706592 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.30.695','DD-MM-YY HH24:MI:SS:FF3' ),49.55,705581 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.31.227','DD-MM-YY HH24:MI:SS:FF3' ),49.55,707985 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.31.820','DD-MM-YY HH24:MI:SS:FF3' ),49.56,708494 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.32.258','DD-MM-YY HH24:MI:SS:FF3' ),49.57,708955 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.36.180','DD-MM-YY HH24:MI:SS:FF3' ),49.58,709519 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.44.352','DD-MM-YY HH24:MI:SS:FF3' ),49.59,710502 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.44.352','DD-MM-YY HH24:MI:SS:FF3' ),49.59,710102 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.44.352','DD-MM-YY HH24:MI:SS:FF3' ),49.59,709962 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.52.399','DD-MM-YY HH24:MI:SS:FF3' ),49.59,711427 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.44.977','DD-MM-YY HH24:MI:SS:FF3' ),49.6,710902 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.50.492','DD-MM-YY HH24:MI:SS:FF3' ),49.6,711379 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.45.550','DD-MM-YY HH24:MI:SS:FF3' ),49.6,711302 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.00.50.492','DD-MM-YY HH24:MI:SS:FF3' ),49.62,711417 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.57.790','DD-MM-YY HH24:MI:SS:FF3' ),49.49,715587 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.47.712','DD-MM-YY HH24:MI:SS:FF3' ),49.5,715166 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.57.790','DD-MM-YY HH24:MI:SS:FF3' ),49.5,715469 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.24.821','DD-MM-YY HH24:MI:SS:FF3' ),49.53,714833 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.24.821','DD-MM-YY HH24:MI:SS:FF3' ),49.53,714914 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.24.493','DD-MM-YY HH24:MI:SS:FF3' ),49.54,714136 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.19.977','DD-MM-YY HH24:MI:SS:FF3' ),49.55,713387 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.19.977','DD-MM-YY HH24:MI:SS:FF3' ),49.55,713562 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.08.695','DD-MM-YY HH24:MI:SS:FF3' ),49.59,712172 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.09.274','DD-MM-YY HH24:MI:SS:FF3' ),49.59,713287 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.09.117','DD-MM-YY HH24:MI:SS:FF3' ),49.59,713206 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.08.695','DD-MM-YY HH24:MI:SS:FF3' ),49.59,712984 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.08.836','DD-MM-YY HH24:MI:SS:FF3' ),49.59,712997 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.08.695','DD-MM-YY HH24:MI:SS:FF3' ),49.59,712185 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.01.08.695','DD-MM-YY HH24:MI:SS:FF3' ),49.59,712261 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.32.244','DD-MM-YY HH24:MI:SS:FF3' ),49.46,725577 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.26.181','DD-MM-YY HH24:MI:SS:FF3' ),49.49,724664 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.25.540','DD-MM-YY HH24:MI:SS:FF3' ),49.49,723366 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.26.181','DD-MM-YY HH24:MI:SS:FF3' ),49.49,725242 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.26.181','DD-MM-YY HH24:MI:SS:FF3' ),49.49,725477 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.25.947','DD-MM-YY HH24:MI:SS:FF3' ),49.49,724521 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.25.540','DD-MM-YY HH24:MI:SS:FF3' ),49.49,723943 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.25.540','DD-MM-YY HH24:MI:SS:FF3' ),49.49,724086 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.34.103','DD-MM-YY HH24:MI:SS:FF3' ),49.49,725609 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.15.118','DD-MM-YY HH24:MI:SS:FF3' ),49.5,720166 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.15.118','DD-MM-YY HH24:MI:SS:FF3' ),49.5,720066 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.11.774','DD-MM-YY HH24:MI:SS:FF3' ),49.5,718524 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.15.696','DD-MM-YY HH24:MI:SS:FF3' ),49.5,722086 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.11.774','DD-MM-YY HH24:MI:SS:FF3' ),49.5,718092 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.11.774','DD-MM-YY HH24:MI:SS:FF3' ),49.5,715673 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.15.118','DD-MM-YY HH24:MI:SS:FF3' ),49.51,719666 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.02.12.555','DD-MM-YY HH24:MI:SS:FF3' ),49.52,719384 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.03.28.963','DD-MM-YY HH24:MI:SS:FF3' ),49.48,728830 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.03.11.884','DD-MM-YY HH24:MI:SS:FF3' ),49.48,726609 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.03.28.963','DD-MM-YY HH24:MI:SS:FF3' ),49.48,728943 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.03.45.947','DD-MM-YY HH24:MI:SS:FF3' ),49.49,729627 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.03.12.259','DD-MM-YY HH24:MI:SS:FF3' ),49.49,726830 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.03.46.494','DD-MM-YY HH24:MI:SS:FF3' ),49.49,733653 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.03.46.510','DD-MM-YY HH24:MI:SS:FF3' ),49.49,733772 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.03.12.259','DD-MM-YY HH24:MI:SS:FF3' ),49.49,727830 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.03.59.119','DD-MM-YY HH24:MI:SS:FF3' ),49.5,735772 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.03.47.369','DD-MM-YY HH24:MI:SS:FF3' ),49.5,734772 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.20.463','DD-MM-YY HH24:MI:SS:FF3' ),49.48,740621 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.12.369','DD-MM-YY HH24:MI:SS:FF3' ),49.48,740538 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.20.463','DD-MM-YY HH24:MI:SS:FF3' ),49.48,741021 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.10.588','DD-MM-YY HH24:MI:SS:FF3' ),49.49,740138 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.09.463','DD-MM-YY HH24:MI:SS:FF3' ),49.49,738320 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.09.135','DD-MM-YY HH24:MI:SS:FF3' ),49.49,737122 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.09.135','DD-MM-YY HH24:MI:SS:FF3' ),49.49,736424 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.09.260','DD-MM-YY HH24:MI:SS:FF3' ),49.49,737598 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.09.744','DD-MM-YY HH24:MI:SS:FF3' ),49.49,739360 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.09.135','DD-MM-YY HH24:MI:SS:FF3' ),49.49,736924 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.09.260','DD-MM-YY HH24:MI:SS:FF3' ),49.49,737784 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.09.463','DD-MM-YY HH24:MI:SS:FF3' ),49.49,738145 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.09.744','DD-MM-YY HH24:MI:SS:FF3' ),49.49,739134 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.09.463','DD-MM-YY HH24:MI:SS:FF3' ),49.49,738831 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.56.215','DD-MM-YY HH24:MI:SS:FF3' ),49.5,742421 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.56.580','DD-MM-YY HH24:MI:SS:FF3' ),49.5,741777 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.56.215','DD-MM-YY HH24:MI:SS:FF3' ),49.5,742021 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.48.433','DD-MM-YY HH24:MI:SS:FF3' ),49.5,741091 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.56.840','DD-MM-YY HH24:MI:SS:FF3' ),49.51,743021 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.04.57.511','DD-MM-YY HH24:MI:SS:FF3' ),49.52,743497 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.05.00.270','DD-MM-YY HH24:MI:SS:FF3' ),49.52,744021 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.05.17.699','DD-MM-YY HH24:MI:SS:FF3' ),49.53,750292 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.05.00.433','DD-MM-YY HH24:MI:SS:FF3' ),49.53,747382 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.05.17.699','DD-MM-YY HH24:MI:SS:FF3' ),49.53,749939 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.05.15.152','DD-MM-YY HH24:MI:SS:FF3' ),49.53,749414 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.05.00.433','DD-MM-YY HH24:MI:SS:FF3' ),49.53,744882 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.05.08.110','DD-MM-YY HH24:MI:SS:FF3' ),49.54,749262 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.05.01.168','DD-MM-YY HH24:MI:SS:FF3' ),49.54,748418 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.05.01.152','DD-MM-YY HH24:MI:SS:FF3' ),49.54,748243 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.05.07.293','DD-MM-YY HH24:MI:SS:FF3' ),49.54,748862 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.09.433','DD-MM-YY HH24:MI:SS:FF3' ),49.51,750414 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.28.262','DD-MM-YY HH24:MI:SS:FF3' ),49.53,750930 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.28.887','DD-MM-YY HH24:MI:SS:FF3' ),49.53,751986 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.28.887','DD-MM-YY HH24:MI:SS:FF3' ),49.53,750986 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.30.997','DD-MM-YY HH24:MI:SS:FF3' ),49.55,753900 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.30.887','DD-MM-YY HH24:MI:SS:FF3' ),49.55,753222 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.29.809','DD-MM-YY HH24:MI:SS:FF3' ),49.55,753022 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.29.809','DD-MM-YY HH24:MI:SS:FF3' ),49.55,752847 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.42.622','DD-MM-YY HH24:MI:SS:FF3' ),49.56,755385 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.31.120','DD-MM-YY HH24:MI:SS:FF3' ),49.56,754385 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.49.590','DD-MM-YY HH24:MI:SS:FF3' ),49.6,759087 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.50.341','DD-MM-YY HH24:MI:SS:FF3' ),49.6,759217 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.49.590','DD-MM-YY HH24:MI:SS:FF3' ),49.6,758701 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.57.262','DD-MM-YY HH24:MI:SS:FF3' ),49.6,761049 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.48.637','DD-MM-YY HH24:MI:SS:FF3' ),49.6,757827 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.48.120','DD-MM-YY HH24:MI:SS:FF3' ),49.6,757385 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.56.466','DD-MM-YY HH24:MI:SS:FF3' ),49.62,761001 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.56.137','DD-MM-YY HH24:MI:SS:FF3' ),49.62,760109 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.56.137','DD-MM-YY HH24:MI:SS:FF3' ),49.62,759617 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.56.278','DD-MM-YY HH24:MI:SS:FF3' ),49.62,760265 );
insert into mytable1 values (to_timestamp ('04-MAR-08 09.06.56.137','DD-MM-YY HH24:MI:SS:FF3' ),49.62,759954 );
so if I do
SELECT DISTINCT row_number() over( partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 order by TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 ASC ) num,
MIN(price) over (partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60) low ,
MAX(price) over (partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60) high ,
-- sum(volume) over( partition by trunc(my_time, 'hh24') + (trunc(to_char(my_time,'mi')))/24/60 order by trunc(my_time, 'hh24') + (trunc(to_char(my_time,'mi')))/24/60 asc ) volume,
TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 TIME ,
price ,
COUNT( *) over( partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 order by TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 ASC ,price ASC,volume ASC ) TRADE,
first_value(price) over( partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 order by TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 ASC,volume ASC ) OPEN ,
first_value(price) over( partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 order by TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 DESC,volume DESC) CLOSE ,
lag(price) over ( order by TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60) lag_all
FROM mytable1
WHERE my_time > to_timestamp('04032008:09:00:00','DDMMYYYY:HH24:MI:SS')
AND my_time < to_timestamp('04032008:09:01:00','DDMMYYYY:HH24:MI:SS')
GROUP BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 ,
price ,
volume
ORDER BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60,
price ,
num;
i have
NUM|LOW|HIGH|TIME|PRICE|TRADE|OPEN|CLOSE|LAG_ALL
1|49.55|49.62|04/03/2008 09:00:00|49.55|1|49.55|49.59|
2|49.55|49.62|04/03/2008 09:00:00|49.55|2|49.55|49.59|49.55
3|49.55|49.62|04/03/2008 09:00:00|49.55|3|49.55|49.59|49.55
4|49.55|49.62|04/03/2008 09:00:00|49.55|4|49.55|49.59|49.55
5|49.55|49.62|04/03/2008 09:00:00|49.55|5|49.55|49.59|49.55
6|49.55|49.62|04/03/2008 09:00:00|49.55|6|49.55|49.59|49.55
7|49.55|49.62|04/03/2008 09:00:00|49.56|7|49.55|49.59|49.55
8|49.55|49.62|04/03/2008 09:00:00|49.57|8|49.55|49.59|49.56
9|49.55|49.62|04/03/2008 09:00:00|49.58|9|49.55|49.59|49.57
10|49.55|49.62|04/03/2008 09:00:00|49.59|10|49.55|49.59|49.58
11|49.55|49.62|04/03/2008 09:00:00|49.59|11|49.55|49.59|49.59
12|49.55|49.62|04/03/2008 09:00:00|49.59|12|49.55|49.59|49.59
13|49.55|49.62|04/03/2008 09:00:00|49.59|13|49.55|49.59|49.59
14|49.55|49.62|04/03/2008 09:00:00|49.6|14|49.55|49.59|49.59
15|49.55|49.62|04/03/2008 09:00:00|49.6|15|49.55|49.59|49.6
16|49.55|49.62|04/03/2008 09:00:00|49.6|16|49.55|49.59|49.6
17|49.55|49.62|04/03/2008 09:00:00|49.62|17|49.55|49.59|49.6
Witch is errouneous
because
if I do'nt put the volume column in the script I get another result
SELECT DISTINCT row_number() over( partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 order by TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 ASC ) num,
MIN(price) over (partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60) low ,
MAX(price) over (partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60) high ,
-- sum(volume) over( partition by trunc(my_time, 'hh24') + (trunc(to_char(my_time,'mi')))/24/60 order by trunc(my_time, 'hh24') + (trunc(to_char(my_time,'mi')))/24/60 asc ) volume,
TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 TIME ,
price ,
COUNT( *) over( partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 order by TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 ASC ,price ASC ) TRADE,
first_value(price) over( partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 order by TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 ASC ) OPEN ,
first_value(price) over( partition BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 order by TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 DESC) CLOSE ,
lag(price) over ( order by TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60) lag_all
FROM mytable1
WHERE my_time > to_timestamp('04032008:09:00:00','DDMMYYYY:HH24:MI:SS')
AND my_time < to_timestamp('04032008:09:01:00','DDMMYYYY:HH24:MI:SS')
GROUP BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60 ,
price
ORDER BY TRUNC(my_time, 'hh24') + (TRUNC(TO_CHAR(my_time,'mi')))/24/60,
price ,
num;
I get this
NUM|LOW|HIGH|TIME|PRICE|TRADE|OPEN|CLOSE|LAG_ALL
1|49.55|49.62|04/03/2008 09:00:00|49.55|1|49.55|49.55|
2|49.55|49.62|04/03/2008 09:00:00|49.56|2|49.55|49.55|49.55
3|49.55|49.62|04/03/2008 09:00:00|49.57|3|49.55|49.55|49.56
4|49.55|49.62|04/03/2008 09:00:00|49.58|4|49.55|49.55|49.57
5|49.55|49.62|04/03/2008 09:00:00|49.59|5|49.55|49.55|49.58
6|49.55|49.62|04/03/2008 09:00:00|49.6|6|49.55|49.55|49.59
7|49.55|49.62|04/03/2008 09:00:00|49.62|7|49.55|49.55|49.6
How can I have the right count with all the column of the table?
BabataI'm not sure what in your eye the "right count" is. but I think the DISTINCT keyword is hiding the problems that you have. It could also be the reason for the different number of results between query one and query two.
-
Creation of Group for Order type
Dear All,
I have created the stage wise order
types ,now I am trying to create a group for each order
type, while doing this I maintained text &
no.range for the same,
but system is not creating new group,
it replaced the existing group.(OPJH )
please guide me to solve this difficulty
Thanks in advance
Rgds,
Vijay MankarHi Vijay,
1. To create a new group "F6" now type the description and the number interval. Now hit enter. New group is created
2. You need to select the new Number Range Group by selecting the check box on the left side of the group.
3. Place your cursor on the Order type decsription and use "F2" to select the line.
4. Now you need to hit the "Element/Group" icon or F5 in key board to assign the order type to the number range group.
Save the changes now. Number ranges are generally not transported, so you need to do this directly in the client where it is needed.
Hope this steps will help you in understanding how this has to be done. Reward your points,
Regards,
Prasobh -
How to change the Group Sort Order
I'm using Crystal XI version to create a report that has two "Group By" fields.
I understand the sequence (Group 1, Group 2) in which the fields are sorted, however I was wondering whether there is a way to sort by ONLY the Group 2 field.
If this is possible, I would appreciate the instructions on how to do it.
ThanksHello Paul,
Crystal will 'tier' all the groups in such a way that Group 1 will always be sorted first. IE:
G1
G2
G1
G2
G2
G1
You can modify the order of the values in each group, but if you want to sort by Group 2 then it will have to be the "outermost" group.
Let me know if this helps,
-Sean
Maybe you are looking for
-
New external hard drive wont recognized in itunes
I have an external hard drive for storage, on itunes its recognized normally. So, I bought a bigger hard drive, and copies aññ the previous stuff of the previous one, on Itunes settings I have changed the settings so the new hard drive would be recog
-
Adding a domain name from Plesk Parallels?
I am completely lost in adding a domain name which I have bought to Muse. I have control panel access with Plesk Paralles but I have no idea what to do to make it all connect? Does anyone know? Any help would be fantastic. Thanks
-
clicking noise coming form my new 27" iMac custom order (loaded machine) anybody having the same problem? I mean this unit is a day old.
-
Why won't my nike and iPod app work anymore
Why won't my Nike+iPod app work on my iPod touch anymore? I just get a red screen then it closes. Anyone have an idea why this happens. It work fine not to long ago but I went to use it today and it's not working.
-
When I installed my CS5 suite I chose to not install Photoshop 32 bit can I later?
When I installed my CS5 suite I chose to not install Photoshop 32 bit can I later without installing the whole suite ?