Creating Max Querry

I am looking to create query to find a Maximum value in a column called "total_full_energy_b" between the dates of X and Y.  The dates are all sent and live in column "cdate".  Any help would be greatly appreciated.
My SQL programmer is on vacation and I know just enough to be dangerous. Thanks.

you should try posting the query in SQL forum to get better results as the question seems not related to cm07.
SQL forums http://social.technet.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver
http://social.technet.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlreportingservices
Eswar Koneti | Configmgr blog:
www.eskonr.com | Linkedin: Eswar Koneti
| Twitter: Eskonr

Similar Messages

  • How do I create a querry in sb1 2004

    Hi all
    I want to create a query.
    I looked in tools-> queries -> query manager
    but i doesn't enable me to create new queries only run the existing ones
    So how do i create queries?
    appreciate the help
    Yoav

    Hi,
    To create a query you have to go to Reports > Query Generator
    Regards,
    vanesa

  • Report only MAX value in a query

    I have two tables I'm joining, a one to many relationship exists.
    1 -> Many
    A -> B
    I want a few columns from table A in the report, along with a couple columns from table B.
    Contents of table B are:
    Product
    Start_Date
    Last_Activity_Date
    Sample of data from table B:
    PRIMARY,08/24/2007,08/24/2007
    PRIMARY,08/24/2008,08/20/2009
    PRIMARY,08/30/2008,08/26/2009
    PRIMARY,08/01/2009,08/30/2009
    How do I code the query so that only the last row is returned (the one with the highest Last_Activity_Date)? I originally thought I could use MAX(Last_Activity_Date) but that isn't working.
    Discoverer's original code:
    SELECT /*+ FIRST_ROWS */
         A.ASSOCIATE_NO Assoc_No,
         A.CLIENT_NO Clt_No,
         A.CLIENT_NAME Clt_Name,
         A.ACTIVE_EMP_CNT EE_Cnt,
         B.START_DATE Start_Date,
         ' ' AS Filler_Col
    FROM A, B
    WHERE ( (A.ID = B._ID)
    AND (A.ID = B.ID(+)))
    AND (A.PREMIER = 'Y')
    AND ( (A.STATUS IS NULL)
    GROUP BY A.ASSOCIATE_NO,
         A.CLIENT_NO,
         A.CLIENT_NAME,
         A.ACTIVE_EMP_CNT,
         B.PRODUCT,
         B.START_DATE,
         B.LAST_ACTIVITY_DATE
    HAVING (B.PRODUCT_NAME(+) = 'PREMIER'
    AND B.LAST_ACTIVITY_DATE(+) = MAX (B.LAST_ACTIVITY_DATE(+)))
    ORDER BY 1 ASC, 2 ASC;
    Discoverer's code isn't working the way I want it to. It returns all rows from table B.
    How can I code it so that only the row with the highest Last_Activity_Date is returned?
    Thanks for all your help,
    Gary F.

    Hi,
    There are 2 ways of doing this:
    You can create a rank calculation:
    rank() over (partition by client_name, client_no /* and any other columns from A */ order by last_activity_date desc)
    then create a condition where your rank calculation =1.
    Or you can create max calculations for each column in table B and then don't have any conditions. So for your start_date calculation you would have:
    max(start_date) keep (dense_rank last order by last_activity_date)
    The second method is generally the best.
    Rod West

  • Error in Create MaxDb instance

    I am installing NW04S Sneak installtion.
    My installation failled on step 14 of 32 while "create Max DB instace" step with the following error in XCMDOUT log file.
    Subprocess starts at 20060913103942
    Execute Command : e:\sapdb\programs\pgm\dbmcli.exe -n ramaraju -d J2E -u CONTROL,******** param_addvolume 1 DATA E:\sapdb\J2E\sapdata\DISKD0001 F 166400
    Execute Session Command : exit
    > Subprocess stops at 20060913104008
    > Subprocess call failed
    DBM-Api error ( -4'(null)(null)')
    Please help me.

    Thanks for your reply.
    I tried with the commands given by you.But,still i dont understand how to rectify it.
    Please look into the commands result below and suggest me what needs to be done.
    C:\>dbmcli -s inst_enum
    OK
    7.6.00.09    e:\sapdb\j2e\db
    C:\>dbmcli -s db_enum
    OK
    J2E     e:\sapdb\j2e\db                         7.6.00.09       slow    offline
    J2E     e:\sapdb\j2e\db                         7.6.00.09       quick   offline
    J2E     e:\sapdb\j2e\db                         7.6.00.09       fast    offline
    C:\>xinstinfo
    IndepData           : e:\sapdb\data
    IndepPrograms       : e:\sapdb\programs
    C:\>sdbregview -l
    Server Utilities    e:/sapdb/programs        7.6.00.09     32 bit    valid
    DB Analyzer         e:/sapdb/programs        7.6.00.09     32 bit    valid
    PCR 7300            e:/sapdb/programs        7.3.00.53               valid
    Base                e:/sapdb/programs        7.6.00.09     32 bit    valid
    PCR 7301            e:/sapdb/programs        7.3.01.18               valid
    JDBC                e:/sapdb/programs        7.6.00.11               valid
    Messages            e:/sapdb/programs        MSG 0.1208              valid
    ODBC                e:/sapdb/programs        7.6.00.09     32 bit    valid
    Database Kernel     e:/sapdb/j2e/db          7.6.00.09     32 bit    valid
    Loader              e:/sapdb/programs        7.6.00.09     32 bit    valid
    PCR 7104            e:/sapdb/programs        7.1.04.45               valid
    SQLDBC              e:/sapdb/programs        7.6.00.09     32 bit    valid
    PCR 7600            e:/sapdb/programs        7.6.00.09     32 bit    valid
    Webtools            e:/sapdb/programs/web    7.6.00.09     32 bit    valid
    PCR 7403            e:/sapdb/programs        7.4.03.38     32 bit    valid
    C:\>sdbregview -l
    Server Utilities    e:/sapdb/programs        7.6.00.09     32 bit    valid
    DB Analyzer         e:/sapdb/programs        7.6.00.09     32 bit    valid
    PCR 7300            e:/sapdb/programs        7.3.00.53               valid
    Base                e:/sapdb/programs        7.6.00.09     32 bit    valid
    PCR 7301            e:/sapdb/programs        7.3.01.18               valid
    JDBC                e:/sapdb/programs        7.6.00.11               valid
    Messages            e:/sapdb/programs        MSG 0.1208              valid
    ODBC                e:/sapdb/programs        7.6.00.09     32 bit    valid
    Database Kernel     e:/sapdb/j2e/db          7.6.00.09     32 bit    valid
    Loader              e:/sapdb/programs        7.6.00.09     32 bit    valid
    PCR 7104            e:/sapdb/programs        7.1.04.45               valid
    SQLDBC              e:/sapdb/programs        7.6.00.09     32 bit    valid
    PCR 7600            e:/sapdb/programs        7.6.00.09     32 bit    valid
    Webtools            e:/sapdb/programs/web    7.6.00.09     32 bit    valid
    PCR 7403            e:/sapdb/programs        7.4.03.38     32 bit    valid
    C:\>xinstinfo J2E
    IndepData           : e:\sapdb\data
    IndepPrograms       : e:\sapdb\programs
    InstallationPath    : e:\sapdb\j2e\db
    Kernelversion       : KERNEL    7.6.00   BUILD 009-123-105-149
    Rundirectory        : e:\sapdb\data\wrk\J2E
    C:\>dbmcli -s -d J2E -u CONTROL,Start123 db_state
    <b>DBM-Api error ( -4'(null)(null)')</b>
    C:\>dbmcli -n ramaraju -d J2E -u CONTROL,Start123 param_detvolsall
    ERR
    -24977,ERR_COMMAND: Unknown DBM command "param_detvolsall"

  • Addiontal Characteristic to be included in Querry Designer

    Dear BI Experts,
        I have Info-Cube which has exactly 10 characterisc, i create querry for this info-cube already.
        Later then, I change the cube and add mor 1 characteristic, IS it possible for me to include the new characteristic in the querry, or do I have to create new querry and delete old querry.
        Please advice solutions.
    Thanks and Regards,
    KimC.

    Hi,
    There is absolutely no need to create a new query.
    When you do changes in the backend (underlying info providers) the changes get automatically reflected on the front end (query designer).
    Just close your query designer and open it again, you will find the new characteristic that you added in the query designer under the same dimension as present in the cube.
    Hope this helps.
    thanks,
    rahul

  • How to find out Max threads count for Custom Work Manager??

    Hi All,
    How to find out Max threads count for Custom Work Manager??
    I have created 1 WM & targeted it to a cluster of 2 MS. Later I created Max thread Constraint = 300 & assigned that to my WM.
    I need to check how many threads maximum were created by my WM after lets say 1 completed day.
    The idea behind that is to understand if .. 300 is enough or need to increase the same way as we do it for JDBC datasource like.. Active connections Max count.. etc.
    Any Idea?
    regards,
    Tanmay

    Hi Ashish,
    Thanks for your response.
    The monitoring page that you are suggesting does not indicate the max thread count reached for a particular WM.
    For example, If I have Sample WM with 300 Max Thread Constraint, is there a way for me to check how many threads have been used out of 300??
    Any pointers in this regard are appreciated.
    Thanks,
    Tanmay

  • .MAX extension files

    Hi,
    Does anyone know of a program, freeware or share, that will run in Panther so you can view .MAX files?
    Appreciate it.

    Hi 93MacLady!
    As per this site File Extension .MAX Details, it seems there are numerous programs/applications that create .MAX files.
    See if the program recommended here MAX File Extension - Open .MAX files, happens to work for you.
    Link to recommended viewer Nuance - PaperPort 11 - PaperPort Viewers
    You may also find something else, if you look through these max file" mac open - Google Search Results.
    Good Luck!
    ali b

  • How many thread can I create?

    I wrote a multithread program. I use Excutors class and newCachedThreadPool method to create a thread pool.
    I want to create max threads that i can. In some where, I saw Max thread that is allowed, depends on OS, availabe memory, JVM.
    I use SUSE 11.1 as operating system, have 3.75 GB RAM & 7.5 GB swap & use jdk 1.6
    I want to create max threads that i can. I don't know how many i can create.
    please help me.

    Hi _Security, Mutli-Threading isn't always a good thing, because of the constant switching the processor has to do, causing it to be slower then it could be if you properly queued your tasks instead of threading each one. Each thread you create is another thing your processor has to execute each cycle, so if you have tons of threads, your processor will have to execute and switch through each one every cycle, making it bog down performance by a long shot.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • HT204053 How many iCloud account can created in one iOS device?

    Is in one iOS device just can created max 3 account of iCloud? I created 3 on my iPhone, and can't create anymore. I need your help. Thanks.

    Thanks! And if I restore the iPhone will affect to 3 accounts that I havecreated?

  • Querry based alert for minimum inventory

    Dear All,
    I want to set an alert for minimum inventory. for that alert i want to set a querry.
    If there are 10 items in my stock and my minimum inventory is 2. Now if i am going to creat sales quotation or sales order for 15 quantity thn it will have to show me alert popup for creating Purchase order. please help me to create such querry.
    Thanks & regards
    Swapy

    Hi SWAPY,
    There is a system built-in alert "Mininum Stock Deviation", which can meet your requirement. So you don't need to create an new query for this purpose.
    Please find it from Administration->Alerts Management, tick 'Active' and choose the user you want to send Alert to.
    Hope it help.
    Regards,
    Steven Li
    SAP Business One Forums Team

  • Grouped and non-grouped SELECT in one query: help!

    look first at: Wrong result when I use CASE on this forum. Here I wanted to get the user who created and the user who solved a problem (Lets call it Validation Error from now on (VE)).
    The thing is: I already have a query who returns me lots of information about a VE.
    The query in the previous thread returned me additional info about that VE (that is the creating_user and the solving_user). The 1st query is no group select, but the second is! Still, I need to combine those two in one query.
    1st query:
    select ve.seq,
         max((case vah.action when 'C' then vah.ur_code else null end)) created,
         max((case vah.action when 'S' then vah.ur_code else null end)) solved
    from validation_errors ve
    left outer join ver_action_histories vah
    on (ve.seq = vah.ver_seq AND ve.log_date = vah.ver_log_date)
    where ve.seq = 12860687
    group by ve.seq;Result:
    seq       | created | solved
    12860687    Bob       Bobdont mind the "where"-clause, it is just to make the query go faster
    what I do is: I join the VE with the ver_action_histories table which contains the users and what action they performed on a VE.
    Now I just want to add that information to the results of an other query which also returns lots of information about a VE.
    2nd query:
    select ve.seq "VE seq", mh.seq "Counter seq",
              ve.log_date, ve.solve_date, ve.solved Status, ve.failure_code, ve.mde_code,
              mh.meter_type,
              iv.mr_type, iv.mr_reason,
              ih.mmr_seq
    from validation_errors ve
    inner join meter_histories mh
    on (ve.mhy_seq = mh.seq)
    left outer join index_values iv
    on (ve.mhy_seq = iv.mhy_seq AND ve.log_date =iv.timestamp)
    left outer join index_histories ih
    on (ve.mhy_seq = ih.ive_mhy_seq)
    where ve.seq = 8653936
    and sysdate >= mh.start_date
    and sysdate < mh.end_date;dont mind the "where" and "and"-clauses ... I hope the result of this query will simplify things ...
    Result:
    seq        |   counter seq | log_date | solved_date | status    | failure_code | ...
    12860687       4568          1-jan-06   2-jan-06      Solved      ABCNow the actual question: Is it possible to combine those queries in one query? I just want the results of the first query (creating_user and solving_user) to be added as columns to the second result. Performance is very important. Please tell me that its possible?
    Wanted Result:
    seq        |   counter seq | log_date | solved_date | status    | failure_code | created  | solved  | ...
    12860687       4568          1-jan-06   2-jan-06      Solved      ABC            Bob        BobIf anything I explained is unclear, please tell so I can try to explain it in an easier way.

    Try an in line view:
    select *
    from
    ( <your first query goes here > ) a
    , ( <your second query goes here > ) b
    where a.seq = b.seq

  • Planning Security Filters not reflecting in Essbase filters for 2 of 4 cube

    We are using Hyperion Planning with essbase. In essbase we have 4 cubes in essbase (BSCF, EMP, IS, MGN). We would like to add security for the entity dimension as we don't use it currently but we do for other dimensions.
    I have created a new group (FIN_APAC) in SS so that restricted access be given to users in Asia for only their LE(s). Then I enabled security for the LE dimension in planning and set security filters through a command line load. For existing groups I gave write access to all LE members and for the new group (FIN_APAC) I gave write access to certain members.
    When I refresh the security filters in planning they should reflect in Essbase and it does for 2 cubes (BSCF & EMP) but for the other cubes (IS & MGN) the essbase security filters are NONE! In planning all the LE members are set to be included in all plan types.
    The main problem seems to be with this new group (CSR_FIN_APAC) as whenever this group is assigned the essbase filters are not assigned properly. For the existing groups that have added LE security for all members the security filters are updated for 4 cubes as expected.
    Any help appreciated
    x

    When you create a planning application we can create 3 essbase cubes as plan types. if you use Capex, Workforce you can able to create max of 5 databases in Essbase version 11.1.1.3.
    if it is 11.1.2 you can add one more cube
    In your question, have you created 4 Essbase cubes. can you explain how that is possible.
    if all the LE members in all plan types means in 3 Essbase cubes. when you refresh security from planning to essbase that works fine.
    Can you explain the situation perfectly so that can able to give ans.
    Thanks,
    Suneel kanthala.

  • Payment Milestones in SRM?

    Hi
    At the organisation I work at, we have restricted back end SAP purchasing access and are pushing out the use of SRM instead as primary method for users to raise shopping carts, and have a number of catalogues setup for core commodities such as stationary etc.
    However, we have a number of 'project' type contracts that are setup commercially with payment milestones.  The suggestion internally has been to setup each Contract as a catalogue, with all the respective catalogue lines; however, for me, this seems a slightyl strange approach as we will only 'request' each catalogue line against the contract once, allied to each payment milestone.
    Is this the most effective way to setup Contracts with payment milestones to enabling end user purchasing in SRM? Or are there any other useful bits of functionality in SRM that we should be using to meet this need?
    For info, we are using SAP SRM 4.00 (Classic Scenario) and SAP ERP 6.0.
    Thanks in advance
    Edited by: olly_w on Mar 17, 2011 10:54 AM DF

    well,
    here is another suggestion.
    1.  Create Public templates for each Project cotnract (items)
    2.  Create a querry for Project Contract (i.e Public templates) ONLY
    3.  Educate the users to use templates for shopping items from project contracts.
    This might be simple solution than publishing the contract to MDM catalog. Let us know if this works.
    Regs.
    Gummadi

  • Change the field description in the query report

    Dear All,
    I have created a querry using SQVI,It is working fine Now i want to change the field description in the querry report,Please suggest on this.

    Hi,
    follow below steps
    SQVI -> Enter Report name -> Change -> click on layout mode - > Expand tables - > double click on filed names - >
    coming right side you are able see list of output fields .
    Just double click on the field then going to the editable mode Description.
    Thanks
    Balakrishna

  • Fed up with how shuffle handles audiobooks.

    Hello.
    I both love and hate how the shuffle handles audiobooks.
    It is small. it is eaisly concealable. I put the the ear-buds in, I put the pod down my shirt, I attach it to my pants and all I ever nee to do is pause and play.
    Why should I pay so much extra for a screen when I dont need to pick and choose between different songs?
    When I am at work, washing dishes or some other manual task, I love the ability to just quickly bring my hand down to my waist and discreately pause it, never drawing attention to the fact that I am listening to an audio book.
    However, apple has put no effort into their software in regards to how the shuffle or Itunes handles audiobooks.
    First, Itunes automatically syncs the audiobook. Which means I always lose my place. If I want to put a new Dan Carlin podcast on my Ipod, Itunes will automatically synch everything on my ipod with what is on Itunes.... meaning that the bookmarks on my shuffle are replaced with the Itunes Bookmarks.
    Further, every time I accidentally bump my Ipod the wrong way and hit the reverse button, it reverts to the verry beginning of the audiobook.
    I used to just put a butterfly clip on the fast forward button to try to get my place back, but this is apparently so energy inefficient that It loses all of its battery life within an hour. Even if it is fully charged.
    Honestly, how hard would it be to fix these two things.
    Just make it so that, in the case of audiobooks, the bookmark in the Ipod is saved.
    Next, whenever the reverse button on the Ipod is pressed, tell it to never revert to the beginning o the audiobook. only to reverse a little bit, as if it were held down.
    There are other things that would help, such as how fast forwarding was handled, but the above two solutions are so common sense, and provides so much of an improvment, that I would have expected apple to do this a long time agao.
    The new shuffle seems like it would be more akward in terms of trying to conceal it, as the cord of the earbuds would have to be work above the shirt. and it may take an extra second to fumble with where the controls are.
    But even that would be fine if the voice over feature said at what point in the audiobook you were on. But it does now.
    As it is, I am fed up enough that I am asking for advice. Moving away from the shuffle, and perhaps even away from Itunes.
    Does anyone know of a small, clip on MP3 player/ application combo that would best handle audiobooks?
    And if not, is there a way to fix my current problem without spending more money?
    EDIT:
    I really like my shuffle, and would hate to consider going to something like the clip+, but even just being able to know what point I am in in the audiobook would help the auto sync problem. Of coarse, that doesnt play AAC files. and that is all my audiobook builder app creates.

    Max I am sorry you have been facing difficulties applying your updates.  Do you have any specific error messages which you are receiving when attempting to apply the updates?
    If you have not done so already I would recommend reviewing your installation logs to determine the exact error you are experiencing.  You can find details on how to locate and interpret the installation log files at Troubleshoot with install logs | CS5, CS5.5, CS6 - http://helpx.adobe.com/creative-suite/kb/troubleshoot-install-logs-cs5-cs5.html.

Maybe you are looking for