Group by clause- Request for guidance.

Guys,
Could somone please explain me understand the result set of the query below:
While the expect one row to be returned, I returns two. Please note, the timestamp seems to be the same for both the result set.
> select to_chaR(sales_date,'dd-mon-yyyy HH24:MI:SSSSS') as month, count(1) as row_count from fads where trunc(sales_date)= '15-JUN-2009' group by sales_date;
MONTH ROW_COUNT
15-jun-2009 00:00:00000 110383
15-jun-2009 00:00:00000 178845
Thanks!!
-Bhagat
Edited by: Bugs on Feb 5, 2011 1:54 AM

never tried to_char(some_date,'dd.mm.yyyy hh24:mi:sssss') and I don't have a database at hand to verify it
looking at http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#i34924 I see
- SS Second (0-59).
- SSSSS Seconds past midnight (0-86399).
anyway to_char(sales_date,'dd-mon-yyyy HH24:MI:SSSSS') is not the same as sales_date
you would get a single row as a result if it was
Regards
Etbin
Edited by: Etbin on 5.2.2011 11:38
You mean timestamp as data type ? Run
select distinct to_char(sales_date,'dd-mon-yyyy HH24:MI:SS.FF') as month
  from fads
where trunc(sales_date)= '15-JUN-2009'

Similar Messages

  • Grouping of payment requests for Wire transfer  in f110

    Hi Gurus
    Please let me know how to Group the payment requests which has Wire transfer as the payment method. 
    Actually can we group the payment requests for the Wire transfer payment method
    I have to show the balance carried forward for the payment advice by grouping them.
    If you know solution please let me know.
    Thanks in advance
    Meenkashi

    Meenakshi, You can group the payment request with payment  method 'wire'. For grouping them you have to fulfill the following criteria:
    1. On the payment method the 'single payment' should not be checked. This is normally the case and in most situations people realize this after lot of failed efforts to find why it is not grouping.
    2. On the Business Partner master data you should not have checked 'individual payment' in the 'Payment details' TAB under each company code.(BP role 'Counterparty'
    3.In the FRFT screen (if you are doing bank-to-bank transfers and for which you don't need Business Partners) the 'individual payment' should not be checked
    4. Onthe BP master data, if you  select 'same direction' payment requests flowing in one direction (outflow or inflow) can only be grouped. sometime you would need to group both inflow and outflow (for e.g. In case of commercial paper when you invest, you have to pay only the net amount (Principal - Interest). However SAP generates two different flows - Principal which is outflow, Interest which is inflow.)
    5. On the Transaction, in the Payment details TAB you have a slew of options to group - All within Treasury can be grouped, All of a Product category can be grouped, Only flows from an ID no. etc. etc.
    6. On the transaction again in the payment details TAB see to it and that you have not checked 'individual payment'.
    Hope this helps
    Please award points if this information is useful. If you have further doubts please post your doubts and I will try to answer.

  • Backup & Restore loses "Groups" in "Contacts" - request for fix

    Hi,
    I am a new Blackberry user and have found that the Blackberry Link backup/restore functions fail to keep track of my Groups within my Contacts list.  When I carry out a Restore all my Contacts are restored but all my Groups within Contacts disapperar (although the contacts within my Groups are still retained in my Contacts list).
    Does anyone have a fix for this issue please?
    I am using Link v 1.2.1 (build18) and BB release 10.2.1.2977 on my Z10.
    I do not want to Sync my phone contacts with my Address Book on my Mac since I use them independently.
    Thank you for your advice!!

    Yeah, for some reason Groups are not restored. Syncing wouldn't work anyway since groups are not sync'd either.
    I would suggest updating to the latest version of LInk which is 1.2.3.48. I haven't tested for the backup/restore of groups, though.
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

  • MV refresh failure...Request for guidance.!!!

    Guys,
    I've got to find that an MV Refresh that is supposed to happen last night via an automated script has failed with the error below:
    ORA-12008: error in materialized view refresh path
    ORA-08103: object no longer exists
    As a workaround, I have manually refreshed the MV, and it worked fine. Could somone shed thoughts on what could've lead to the failure?It has been working all along, the objects referenced in the MV are owned by the schema from where refresh is done.
    Thanks!!!!
    -Bhagat

    Can you check the dependencies of the MV. Check whether all the dependent object used within the MV definitions exist in valid state. If any db link is there, check its working fine.
    Make sure the access privelegs are fine for all the objects.

  • Convert rows to columns ..Request for guidance.

    Guys,
    I've table data as below:
    process param_val
    1 xxx
    1 yyy
    1 zzz
    2 aaa
    2 bbb
    And I would need the output as below:
    1 xxx yyy zzz
    2 aaa bbb
    Could someone help me with the query plz?..
    -Bhagat

    Hi
    Could try like this
    select
    Process,
    rtrim (xmlagg (xmlelement (e, para_val|| ' ' )).extract ('//text()'), ',') Param_values
    from
    test_1
    group by
    Process
    Hopes this might helps you.
    Regards
    Srikkanth.M
    Edited by: Srikkanth.M on May 30, 2011 9:51 AM

  • Russian characterset insert fails..Request for guidance.

    Guys,
    I've been trying to insert the Russian character string "СТАВРОПОЛЬСКИЙ КР" into my database object-column defined as VARCHAR (25) -using GUI.
    The insert is failing, it doesn't give information about the cause of the failure though.
    Could somone guide me...Could it be becaz of the lenght of the string exceeding 25 characters?
    Is there a way that I can get the lenght of the string. Please note, it's Russian character string.
    Thank you All!!!
    -Bhagat

    Russian characters will be displayed as inverted questions "¿¿¿¿¿ ¿¿¿¿¿¿" in toad.
    So the query won't help determining the lenght of the string.
    -Bhagat

  • -- SQL -- GROUP BY clause: non-aggregate fields mandate

    Hello,
    I was studying Databases, (particularly the retrieval of the data), and found something interesting.
    While using an Aggregate Function in the SELECT clause, it is mandatory to have all the non-aggregate fields in the SELECT clause to be there in the GROUP BY clause.
    For example,
    SELECT dept_no, SUM(salary)
    FROM employee
    GROUP BY dept_no;
    The above SQL works fine.
    But, what if the user misses the dept_no in the GROUP BY clause or he/she misses the GROUP BY clause itself?
    Certainly, it is an error.
    Why is this error not handled by the database. I mean, the database should be smart/intelligent enough to add the GROUP BY clause by itself. So suppose, if I miss out the GROUP BY clause or miss a non-aggregate field from the SELECT clause when I am having at least one aggregate function on a field with at least one non-aggregated field in the SELECT clause, the database should check the GROUP BY clause at time of compilation and add the mandate missed out fields in the GROUP BY clause.
    Example,
    SQL1:_
    SELECT dept_no, SUM(salary)
    FROM employee
    GROUP BY dept_no;
    SQL2:_
    SELECT dept_no, SUM(salary)
    FROM employee;
    Here, the SQL1 and SQL2, both should give me same outputs without an error.
    I am unable to understand why is this not handled?

    Hi,
    998478 wrote:
    ... If we mix aggregate and non-aggregate values then there must be a GROUP BY clause containing all the non-aggregate values. Why is this not handled by the database/compiler itself? It IS handled by the compiler itself. The compiler handles it by raising an error. The compiler has no way of knowing whether you want to remove something from the SELECT clause, or to add something to the GROUP BY clause, or not to use aggregate functions, or to use more aggregate functions, or some combination of the above. If the compiler re-wrote your code, and did any of these things automatically, it would be wrong more often than it was right, and you would (rightly) be complaining about its behavior.
    For example, this is clearly wrong:
    SELECT    deptno
    ,       job
    ,       SUM (sal)
    FROM       scott.emp
    GROUP BY  deptno
    ;What is the right way to fix it?
    <h3>1. Remove something from the SELECT clause</h3>
    SELECT    deptno
    ,       SUM (sal)
    FROM       scott.emp
    GROUP BY  deptno
    ;<h3>2. Add something to the GROUP BY clause</h3>
    SELECT    deptno
    ,       job
    ,       SUM (sal)
    FROM       scott.emp
    GROUP BY  deptno
    ,         job
    ;<h3>3. Not use aggregate functions</h3>
    SELECT    deptno
    ,       job
    ,       sal
    FROM       scott.emp
    ;<h3>4. Use more aggregate functions</h3>
    SELECT    deptno
    ,       MIN (job)
    ,       SUM (sal)
    FROM       scott.emp
    GROUP BY  deptno
    ;These aren't all the options, either. For example, the correct fix might be to use analytic functions instead of aggregate functions.
    How can anybody say which of these is right? All of them are the right answer for some problem.
    By the way, saying that everying in the SELECT clause must be an aggregate or in the GROUP BY clause is a bit over-simplified.
    More completely, here are the ABC's of GROUP BY:
    When you use a GROUP BY clause and/or an aggregate function, then everything in the SELECT clause must be:
    (A) an <b>A</b>ggregate function,
    (B) one of the "group <b>B</b>y" expressions,
    (C) a <b>C</b>onstant, or
    (D) something that <b>D</b>epends entirely on the above. (For example, if you "GROUP BY TRUNC(dt)", you can SELECT "TO_CHAR (TRUNC(dt), 'Mon-DD')").
    Edited by: Frank Kulash on Apr 13, 2013 1:44 PM
    Added code examples.

  • How to include case stmt in group by clause

    Hi i have a question,
    How do i include a case statement in the group by clause?
    For example:
    Select
    (case when x.ctry is null then y.ctry else x.ctry end) as coo,
    sum (x.in_amt)
    from
    tbl1 x,
    tbl2 y
    where
    x.id = y.id
    group by
    (case when x.ctry is null then y.ctry else x.ctry end)
    Assume, I have got millions of records in both the tables, then my guess is, the above query might take huge time to complete.
    Any alternate method to do this?

    cd/ wrote:
    To remove the expression from the GROUP BY clause. I didn't advocate any performance improvements, did I?No you didn't. And your advice can indeed remove the expression from the GROUP BY clause. But I'm still puzzled as to why that would be a goal in itself.
    Regards,
    Rob.

  • Count(*) in select statement having group by clause

    Hi
    I would like to use count(*) in select statement having group by clause. say for example there is a state with a number of cities listed. I would like to get the count of cities for each state.
    the sql stement is grouped by city and it is joined with 5 more tables.
    Thanks

    I suspect you want to look into analytic functions (assuming you have a recent version of Oracle). asktom.oracle.com has numerous examples if you do a search.
    Justin

  • Self service - request for groups - OIM

    I would like to allow end-user to request groups from end-user interface?
    I would appreciate your guidance...
    Out of the box only resources are available for request.

    I can suggest you one approach to meet this req.
    1. Create a scheduler which will fetch all groups(findGroups()) in OIM and write the result to Lookup, say Lookup.OIM.Groups
    2. Create a Process Form with a a field as Groups and make the field type as lookup type and attach the lookup Lookup.OIM.Groups to this field.
    3. Create an adapter which would use addMemberUser() in groupOperations and adds the user to specific group.
    4. Create a RO, say "Provision Groups" then create a Process Def and attach the above created adapter to process task, say "Add User to OIM group".
    Have an approval process in place which allows users to select a group and request for approval. Once approval completes the task "Add User to OIM group" gets called which adds the user to specific group.
    It would be better if you show Groups field in child form which allows user to add more groups.
    This is one approach which i can think of as of now.
    lets see what experts say..

  • How to create a new request for function group?

    Hi Friends,
    My client has changed their development server. Now all the objects in old DEV server are transfered to new one. Except for function group objects, we have created new change request number for all others. Now I need to create a new request for function group objects. Can anyone suggest which transaction code I have to use for this purpose?
    Thanks,
    Kaarthick.V

    Hi Karthick,
    If you want to Change the request for your FG means,
    1. Go to SE80 ->  work bench ->  Edit object.
    Here you have the option two change the request.
    or If you want to create the Function Group means,
    Go to SE80 -> Select Function Group -> Enter name -> press Enter
    Thanks,
    Reward If Helpful.

  • Reg - Search Form for a VO with group by clause

    Hi,
    I have a Bar graph that displays data based on the Query below.
    SELECT STATUS.STATUS_ID AS STATUSID,STATUS.STATUS,COUNT(SR.SERVICEREQUEST_ID) AS SRCOUNT
    FROM SERVICE_REQUEST SR ,SERVICEREQUESTSTATUS STATUS
    WHERE SR.STATUS_ID = STATUS.STATUS_ID
    GROUP BY STATUS.STATUS_ID,STATUS.STATUS,SR.STATUS_ID
    It displays the count of SRs against a particular status.
    Now I need to add a search form to this graph with customer and date range.
    So we need to add the line below to the where clause.
    "SR.CUSTOMER_ID = :customerId AND SR.REQUESTED_ON BETWEEN :fromDate and :toDate"
    But the columns SR.CUSTOMER_ID, SR.REQUESTED_ON also need to be added to the select clause to create the View criteria for search panel.
    The two columns should also need to be added to the group by clause if we are to add them in the select clause.
    This would not produce the expected results.
    How do I create a search form with the criterias applied only at the where clause.Please help.
    With Regards,
    Guna

    The [url http://docs.oracle.com/cd/E16162_01/apirefs.1112/e17483/oracle/jbo/server/ViewObjectImpl.html]ViewObjectImpl has methods for doing this programmatically (setQuery, defineNamedWhereClauseParam, setNamedWhereClauseParam) that you can use to manipulate the query, the bind variables expected, and the values for the binds.
    John

  • How does a user respond to an email request for group scheduling?

    How does a user respond to an email request for group scheduling?
    <P>
    The iPlanet Calendar Server(iCS) 2.x is a personal calendar system. As such,
    messages that are sent out are "publish" type messages, where no responses are
    expected. A future release of iCS will support group scheduling and will allow
    users to respond to email requests by returning the emails. These email
    requests will conform to the iTIP / iMIP standard, which means that they will
    also work for Microsoft Exchange users and for Outlook users using Microsoft
    Exchange.

    An update to what is required and what software did you "purchase" and install?  Aren't you on this forum?  There's no charge to use this forum.........
    Never mind.  I just got your question.  You received an email saying CSound responded to your post.  You don't respond via the email.  You come back to the forum and respond.

  • Grouping clause failing for CLOB Datatype

    Hi,
    I am facing error while Selecting the following expression:
    ORA-00932: inconsistent datatypes: expected - got CLOB
    OBJECT_CONTENT is a CLOB Datatype
    SELECT
    MAX(A.VERSION_ID)
    OBJECT_CONTENT
    FROM
    VERSION_HISTORY A,
    OBJECT_MASTER B
    WHERE
    A.BUOBJECT_ID=B.BUOBJECT_ID
    GROUP BY OBJECT_CONTENT
    Any help will be needful for rme

    So, what's your question? You can use CLOB in the GROUP BY ....
    quote from doc:
    Restrictions on the GROUP BY Clause:
    This clause is subject to the following restrictions:
    You cannot specify LOB columns, nested tables, or varrays as part of expr.
    The expressions can be of any form except scalar subquery expressions.
    If the group_by_clause references any object type columns, then the query will not be parallelized.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#SQLRF01702
    Edited by: Alex Nuijten on Aug 11, 2009 9:02 AM

  • Transport request for function group

    Hi All,
            I have developed a function module in a function group say 'zdeep'.  I have moved the transport request for newly developed function module to production. But there Iam unable to run the function module. 
    Should we transport the function group also to production?
    If so, how can we get the transport request number for the function group?
    I have tried in se80. but there iam not able to track the request no for the function group.
    please help me
    regards
    Murali Krishna .T

    yes i think if u r doing any chnages in func group then it also has to be moved to Reflect chnages..also some proper order is to be maintained while moving TR
    http://wiki.sdn.sap.com/wiki/display/Snippets/Atoolrelatedtotrackingoftransport+request
    check this link
    Edited by: npathak on Aug 14, 2010 8:47 AM

Maybe you are looking for

  • Closing GRNI document

    Hi Experts, I would like to have your thoughts on the below. I have an open Goods Receipt PO dated sometime last year and the period is locked. I need to close the document with current system date. In order to do that I have to open the posting peri

  • Scripting from H4 to H3 or Header

    If I have a bunch of documents made in Acrobat X, I need to write a script that will change the H4 tags to an H3 or Header tag so that the nesting warning will go away.  The document reads perfectly. The way that I am doing this manually, it with the

  • Nq615av - part number for screen replacement cable

    Hi can anyone help? What is the part number for screen cable fpr pavillion dv6t-2000   NQ615AV  - part number for screen replacement cable . Cant find it on support page http://partsurfer.hp.com/Search.aspx?type=PROD&SearchText=NQ615AV Thanks in adva

  • I need help starting the server

    Hello! I am trying to do the HelloWorld rmi-example and I can't get the server started. Can anyone tell me if there's something wrong what I am trying to do. At command prompt I type: java -Djava.rmi.server.codebase="file:///C:/temp/Jaana/aa/examples

  • All the fonts in the font menu within my Illustrator CS5 show up as invisible or blank.

    This happens unless you hover your mouse over them, and then the highlighted font will be visible until you take your mouse off of it.  This has only happened after I updated to the new Yosemite OS on my MacBook Pro.  Does anyone else have the same i