Need a SQL query(Pls Its urgent)

Hi,
I want a SQL query for the foll..
Details r below..
Table AFPFTRAN
BU TRansactiondate Amt
13202 10-04-05 10,000
13203 11-05-05 20,000
13202 20-04-05 5,000
Table AFGENCOD
BU Clerk Name Clerk Code
13202 Amit TFBG
13203 Anand TFMG
I want a query to get data as below..
Tr Date TFBG TFMG
Apr 15,000 0
May 0 20,000
JUn 0 0
Jul 0 0
Aug
Sep
Aug
Nov
DEc
Jan
Feb
Mar
I want this to achieve using a single query...?How can I achive this?
Pls give the sol...
Adios...
Prashanth Deshmukh

Does it look like you need ?
SQL> select * from t;
        BU TDATE           AMT
     13202 10.04.05      10000
     13203 11.05.05      20000
     13202 20.04.05       5000
SQL> select * from t1;
        BU NAME  CODE
     13202 Amit  TFBG
     13203 Anand TFMG
SQL> SELECT pivot_month.mname, tops.TFBG, tops.TFMG
  2  from
  3  (
  4  select to_char(t.tdate,'MM') month_no,
  5  sum(decode(t1.code,'TFBG',t.amt,0)) TFBG,
  6  sum(decode(t1.code,'TFMG',t.amt,0)) TFMG
  7  from t1, t
  8  where t.bu=t1.bu
  9  and to_char(t.tdate,'yyyy') = 2005
10  GROUP BY t1.code, to_char(t.tdate,'MM')
11  ) tops,
12  (select rownum mn, to_char(to_date(rownum,'MM'),'MON') mname,
13  case when rownum between 1 and 3 then rownum + 9
14  else rownum - 3 end rn
15  from dict where rownum < 13) pivot_month
16  where pivot_month.mn = tops.month_no (+)
17  order by pivot_month.rn
18  /
MNA       TFBG       TFMG
APR      15000          0
MAY          0      20000
JUN
JUL
AUG
SEP
OCT
NOV
DEC
JAN
FEB
MAR
12 rows selected.Rgds.

Similar Messages

  • Proxy to JDBC scenario need dynamic sql query for sender .

    Hi Experts,
    I am developing proxy to jdbc scenario. in this i need to pass dynamic sql query  whre we are passing classical method like below.
    while we are passing select stmt in constant and mapped with access field  and key field mapped with key field.
    MY requirement is like instead of passing select stmt in constant where i can generate dynamically and passed in one field and mapped with access field.

    Hi Ravinder,
    A simple UDF or use of graphical mapping functions in most cases should provide you everything you need to construct a dynamic SQL statement for your requirement.
    Regards,
    Ryan Crosby

  • Should every SQL query have its own event and command?

    Hello,
    I am developing an application using Cairngorm. My app uses SQL databases.
    I'm creating a separate event and command for each SQL query my application requires. I end up with many events  and commands - twenty different event/command pairs and I'm not even done yet.
    I was wondering if this is the right way to go, or if somehow similar SQL queries should be grouped together in the same event/command, and if so, how would I implement that elegantly?
    I've never used Cairngorm before so I want to make sure I do it correctly.
    Thank you for your time and any assistance you can offer.

    From my point of view, writing any SQL query or making queries directly from the presentation layer (eg. flex) to the db server it's almost always incorrect, awfull and maybe even insecure. The client layer should be more independent from the implementation layer as for instance the db server you are using. Instead you should call services on the server side and then they should have a DAO layer o whatever where the queries are done. You could then invoke one of this services and pass parameters that indicates what you want to do. (except you are using remoting where you will be invoking methods directly)
    Consider the case where you have a Java implemented service layer, you could be using hibernate to access the database and not writing a single line of SQL (maybe some HQL) and then you could do all the queries you need and return the beans retrieved from the database to the client layer using AMF3 and it's serialization/deserialization mechanisms. In a future you could modify your app to use JPA and then this layer use hibernate, then you client layer will remain the same the only changes will be done under the DAO layer.
    So again, in my opinion, db server should never be accesed directly from the presentation layer (Flex, Air or whatever) but from the backend services and this sould be completly abstract to the client layer. I have seen some people trying to do SQL queries from Flash but that it's giving a task to the Flash player it has never been intended to do. A miss use of the thin client the Flash Player is and an bad architecture.
    It would be great to hear others opinions.

  • Workspace  error.pls its urgent

    Hi All,
    I have installed hyperion 11.1.1.2 version.When I have configured workspace,I am getting the following error"Register with shared services status is failed"
    Anyone could help me for this.
    Please its Urgent for me.
    Many thanks to all
    selva

    hmmmm... this is a forum... not an online training portal....
    You can google and find out how to create JSP(stepwise)
    http://java.sun.com/products/jsp/docs.html

  • Need a SQL Query (URGENT)

    Hi Folks,
    I have 2 tables, in which the 1st one has 200 columns and 2 table had 2 columns.. There is one common column for both the tables, but there is little change in schema of the tables...The common col in 2nd table is a primary key but the same column in the 1st table is a ordinary one..The data type for the common column is same...
    Now i need to write a query to select 199columns(except the common column)from the 1st table and the other column(2nd col)other than the common column frm the 2nd table for "table1.commoncolumn=table2.commoncolumn"......
    I had tried the natural join but its nt working in my informix sql database....I also tried by explicitly mentioning column names like "select column1,column2....column199,table2.column2 from table1,table2 where table1.commoncolumn=table2.commoncolumn", but its having a severe performance impact.......
    Can some please suggest a query for the above one?? Thankx in advance..

    Please gimme possible solutions & suggestions regarding the above query....
    The informix z forum very slow...The problem is, you labeled your questions badly. As this is a forum of volunteers people tend to react badly to the use of the word "urgent" in the subject line. Nobody's question matters more than anybody else's. In fact some regulars won't answer questions with "urgent" in the strapline as a matter of principle.
    Then when we get to actually read your question it turns out to be a question about Informix. I guess not many people here use Informix so your potential pool of responders is pretty small (for instance I'm not even sure how to spell it).
    It's not our fault the Informix forums are so lame.
    Anyway, what I suggest is you repost your question with a new title: (Off topic) Need help with an INFORMIX query.
    At least that will attract people who might be able to answer your question. Then you need to include the actual query you're running and all the supporting details necessary for people to understand the nature of the performance impact.
    You need to ask the right people and you need to ask the right question. This is standard etiquette (and indeed common sense) regardless of which forum you're using.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • Urgent need a SQL Query

    Hi all
    i have a variable that store consequitive ; like 'abc;;;;def;;;gh;;;;lm'.
    i want to replace all the consequitive ; with the single ; .
    eg out put like 'abc;def;gh;lm'
    send the sql or pl/sql ASAP. its very urgent for me.
    thanks in advace

    send the sql or pl/sql ASAP. its very urgent for me.Nobody here cares if something is urgent for you. AT ALL. It is not urgent for us. It is certainly not any more important than other threads on this forum. It IS however completely ignorant for you to assume that your issue is any more important than someone else's issue. Please NEVER use the word urgent in any of your future posts (unless it is relevant to the question)
    On top of that, you have provide a lack of info, such as version, where you are using this value etc.

  • Urgent Sql Query Problem - -Very Urgent

    Hi Guys,
    I need a urgent solution for a problem.I am
    using the following query
    select ename from emp where deptno =10
    Now I will declare a bind variable and if user passes 'A'
    then the query will run as it is and if he passes B
    then it should run the above query with this additional clause -> birthdate - hiredate >15.
    Please can any one help its very urgent

    Assuming that you have a birthdate column in your emp table, the following will do what you are asking for:
    VARIABLE bind_var VARCHAR2(1)
    EXECUTE :bind_var := '&bind_variable'
    SELECT ename FROM
    (SELECT 'A' AS selection, ename FROM emp WHERE deptno = 10
    UNION ALL
    SELECT 'B' AS selection, ename FROM emp WHERE deptno = 10 AND birthdate - hiredate > 15)
    WHERE selection = :bind_var
    However, the clause "birthdate - hiredate > 15" will only retrieve rows for employees who were born more than 15 days after they were hired. I doubt that this is what you really want, since this is impossible.

  • Need the sql query for IN clause.

    Hi All,
    i have item data like --
    IBM 200 and IBM 500
    have present code like this ----select * from emp where in (IBM 200 and IBM 500);
    so i need change or repalce like ('IBM 200','IBM 500')
    Any body please help me out this..
    Need to get out put 'IBM 200','IBM 500' from data IBM 200 and IBM 500 ...
    Edited by: anbarasan on Oct 17, 2011 10:30 PM

    Please consider the following when you post a question. This would help us help you better
    1. New features keep coming in every oracle version so please provide Your Oracle DB Version to get the best possible answer.
    You can use the following query and do a copy past of the output.
    select * from v$version 2. This forum has a very good Search Feature. Please use that before posting your question. Because for most of the questions
    that are asked the answer is already there.
    3. We dont know your DB structure or How your Data is. So you need to let us know. The best way would be to give some sample data like this.
    I have the following table called sales
    with sales
    as
          select 1 sales_id, 1 prod_id, 1001 inv_num, 120 qty from dual
          union all
          select 2 sales_id, 1 prod_id, 1002 inv_num, 25 qty from dual
    select *
      from sales 4. Rather than telling what you want in words its more easier when you give your expected output.
    For example in the above sales table, I want to know the total quantity and number of invoice for each product.
    The output should look like this
    Prod_id   sum_qty   count_inv
    1         145       2 5. When ever you get an error message post the entire error message. With the Error Number, The message and the Line number.
    6. Next thing is a very important thing to remember. Please post only well formatted code. Unformatted code is very hard to read.
    Your code format gets lost when you post it in the Oracle Forum. So in order to preserve it you need to
    use the {noformat}{noformat} tags.
    The usage of the tag is like this.
    <place your code here>\
    7. If you are posting a *Performance Related Question*. Please read
       {thread:id=501834} and {thread:id=863295}.
       Following those guide will be very helpful.
    8. Please keep in mind that this is a public forum. Here No question is URGENT.
       So use of words like *URGENT* or *ASAP* (As Soon As Possible) are considered to be rude.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Help needed for SQL query

    hello ,
    I am a beginner in terms of writing sql queries. I hope some body can help me out.
    I have two tables
    mysql> desc user_group_t;
    ---------------------------------------------------+
    | Field | Type | Null | Key | Default | Extra |
    ---------------------------------------------------+
    | userAccountId | char(8) | | PRI | | |
    | groupId | char(8) | | PRI | | |
    ---------------------------------------------------+
    2 rows in set (0.00 sec)
    mysql> desc group_t;
    ---------------------------------------------------+
    | Field | Type | Null | Key | Default | Extra |
    ---------------------------------------------------+
    | id | char(8) | | PRI | | |
    | name | char(50) | YES | | NULL | |
    | email | char(100) | YES | | NULL | |
    | description | char(254) | YES | | NULL | |
    | parentId | char(8) | YES | | NULL | |
    | creatorId | char(8) | YES | | NULL | |
    | createDate | char(20) | YES | | NULL | |
    | updateDate | char(20) | YES | | NULL | |
    | updatorId | char(8) | YES | | NULL | |
    ---------------------------------------------------+
    9 rows in set (0.00 sec)
    what I want is list of all groups with id,name and #of members(which is the # of rows in the user_group_t for any given id). Importantly I need the groups with 0 members also to be listed. In short my output should contain exactly the same number of rows as in group_t table with an additional column indicating # of members for that group.
    Any help would be greatly appreciated.
    Thanks in Advance.
    -Vasanth

    Thanks Donald,
    Actually I figured it out, with the following query:
    select id,name,sum(if(groupid is not null,1,0)) as members from group_t left join user_group_t on id=groupid group by id;
    I tried your solution, but mysql says there is an error at '+' . Anyway I modified your solution to the one below and it worked.
    select a.id, a.name, count(b.groupid) from group_t a left join user_group_t b on a.id=b.groupid group by a.id, a.name;
    I tried that before but then I used Count(*) instead of count on groupid. Your solution is elagant and I will go with yours.
    Thanks again.
    Vasanth

  • Row to column query ( Please its urgent)

    The query is
    SELECT
    WO.WORKORDERKEY,
    UDF1.PROJECT_MANAGER,
    UDF1.TEAM_MANAGER,
    UDF1.TEAM_LEAD,
    UDF1.CUSTOMER_COORDINATOR,
    UDF1.AVIONICS_LEAD,
    UDF1.INTERIOR_LEAD,
    UDF1.INSPECTOR,
    UDF1.MECHANICAL_ENGINEER,
    UDF1.AVIONICS_ENGINEER,
    UDF1.PLANNER,
    UDF1.PARTS_COORDINATOR,
    UDF1.LOGO_HEADER_SELECTION
    FROM
    WORKORDERS WO,
    SELECT
    DISTINCT WOUD.WORKORDERKEY,
    DECODE(UDF.LABEL,'Project Manager',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS PROJECT_MANAGER,
    DECODE(UDF.LABEL,'Team Manager',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS TEAM_MANAGER,
         DECODE(UDF.LABEL,'Team Lead',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS TEAM_LEAD,
    DECODE(UDF.LABEL,'Customer Coordinator',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS CUSTOMER_COORDINATOR,
    DECODE(UDF.LABEL,'Avionics Lead',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS AVIONICS_LEAD,
    DECODE(UDF.LABEL,'Interior Lead',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS INTERIOR_LEAD,
    DECODE(UDF.LABEL,'Inspector',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS INSPECTOR,
    DECODE(UDF.LABEL,'Mechanical Engineer',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS MECHANICAL_ENGINEER,
    DECODE(UDF.LABEL,'Avionics Engineer',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS AVIONICS_ENGINEER,
    DECODE(UDF.LABEL,'Planner',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS PLANNER,
    DECODE(UDF.LABEL,'Parts Coordinator',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS PARTS_COORDINATOR,
    DECODE(UDF.LABEL,'Report Logo/Header Selection',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS LOGO_HEADER_SELECTION
    FROM
    USERDEFINEDFIELDS UDF,
    WORKORDERUDFDATA WOUD
    WHERE
    UDF.USERDEFINEDFIELDKEY = WOUD.USERDEFINEDFIELDKEY
    AND UDF.LABEL IN('Project Manager','Team Manager','Team Lead','Customer Coordinator','Avionics Lead','Interior Lead','Inspector','Mechanical Engineer','Avionics Engineer','Planner','Parts Coordinator','Report Logo/Header Selection')
    AND UDF.DELETED = 0
    AND WOUD.DELETED = 0
    ) UDF1
    WHERE
    WO.WORKORDERKEY = UDF1.WORKORDERKEY(+);
    The output i am getting like:
    WORKORDERKEY     PROJECT_MANAGER     TEAM_MANAGER     TEAM_LEAD     CUSTOMER_COORDINATOR
    1     abc               
    2          ddf          
    2               rrr     
    3     aaf               
    3                    ege
    i need in single line work order key
    WORKORDERKEY     PROJECT_MANAGER     TEAM_MANAGER     TEAM_LEAD     CUSTOMER_COORDINATOR
    1     abc               
    2          ddf     rrr     
    3     aaf               ege
    Please solve my problem.

    maybe this example might be of some help.
    SQL> select * from pivot_tab;
          COL1 COL2
             1 a
             1 b
             1 c
             2 h
             2 h
    SQL>
    SQL>
    SQL> select p.col1,
      2         substr(max(substr(sys_connect_by_path (p.col2,','),2)),1,60)
      3         as col2
      4    from (select col1,
      5                 col2,
      6                 row_number() over (partition by col1 order by col1, col2) rn
      7            from pivot_tab) p
      8  start with p.rn = 1
      9  connect by p.rn = prior p.rn + 1
    10  and prior p.col1 = p.col1
    11  group by col1;
          COL1 COL2
             1 a,b,c
             2 h,h
    SQL>

  • Pls its urgent

    hi, all
    pls tellme how to run JSP file. pls tell me in detail.i mean stepwise,,,,
    ifi hav to set any changes in tomcat.i musing tmcat5.0.
    thanx in advance.
    its little urgent
    shrikant

    hmmmm... this is a forum... not an online training portal....
    You can google and find out how to create JSP(stepwise)
    http://java.sun.com/products/jsp/docs.html

  • Need of SQL query in selecting distinct values from two tables

    hi,
    I need a query for selecting distinct values from two tables with one condition.
    for eg:
    there are two tables a & b.
    in table a there are values like age,sex,name,empno and in table b valuses are such as age,salary,DOJ,empno.
    here what i need is with the help of empno as unique field,i need to select distinct values from two tables (ie) except age.
    can anybody please help me.
    Thanks in advance,
    Ratheesh

    Not sure what you mean either, but perhaps this will start a dialog:
    SELECT DISTINCT a.empno,
                    a.name,
                    a.sex,
                    b.salary,
                    b.doj
    FROM    a,
            b
    WHERE   a.empno = b.empno;Greg

  • Help Needed In SQL Query

    HI All,
    Oracle sql clarification required
    Sample Table:
    empno empname Job mgr_id hire_date salary deptno
    7788 SCOTT ANALYST 7566 19-APR-87 3000 20
    7902 FORD ANALYST 7566 03-DEC-81 3000 20
    7934 MILLER CLERK 7782 23-JAN-82 1300 10
    7900 JAMES CLERK 7698 03-DEC-81 950 30
    7369 SMITH CLERK 7902 17-DEC-80 800 20
    7876 ADAMS CLERK 7788 23-MAY-87 1100 20
    Need "single / one" sql for this requirement statement:
    There will be 2 drop down boxes (1st - Job list, 2nd - empno) in the form in which the following result set is expected
    1) When user selects value from 1st drop down box (job) as "ANALYST" leaving the second drop down unselected, the result expected is 2 (no. of rows for that job)
    2) When user selects value from 1st drop down box (job) as "ANALYST" and the value from 2nd drop down box as 7902, the result expected is 1 (no of rows for that job and empno)
    Sqls which I have tried from my side (given below) didn't give the expected result and please do help me in correcting this
    select count(1) from scott.emp where job='ANALYST' and ( empno = :empno or empno is null ) ;
    Please help for this requirement. Any help is deeply appreciated.
    Thanks
    Zaheer

    Hi,
    welcome to the forum.
    Please read SQL and PL/SQL FAQ
    When you put some code or output please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    For your question the following will both work:SQL> select * from emp
    where job='ANALYST' and (empno =:empno or :empno is null)
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20
    7902 FORD ANALYST 7566 03/12/1981 00:00:00 3000 20
    2 rows selected.
    SQL> select * from emp
    where job='ANALYST' and empno =NVL(:empno, empno)
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20
    7902 FORD ANALYST 7566 03/12/1981 00:00:00 3000 20
    2 rows selected.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Issue in sql query pls give idea

    Hi everybody,
    I am doing one task which is realted to currency format changing.
    In my OM table i have column total order line amount, i need to show all the amount in us dollar values,also i have currecny_code column like USD,INR etc...
    I want to do convert different currencies into the target format as USD
    For converting i have another table like gl_daily_rates which contains
    from_currency and to_currency columns and also conversion_Rate which values flow based on from and to currency column,,,, like from USD to GPB con..rate will be 1.2.
    I need to calculate this amount with my total order line amount if my currency_code column other than USD.
    Can any one have any ideas please drop it...

    Please provide sample data like this..
    SQL> select * from ord;
            ID        AMT CURR_CODE
             1       1000 USD
             2       1000 INR
             3       1000 GBP
    SQL> select * from rates;
    TO_CURR_C FRM_CURR_CO       RATE
    USD        USD                 1
    USD        GBP           2.01319
    USD        INR              .024
    SQL>  select o.id,o.amt||' '||o.curr_code local,
      2         o.amt*r.rate USD
      3   from ord o,rates r
      4   where o.curr_code = r.frm_curr_code
      5   and r.to_curr_code = 'USD';
            ID LOCAL                                                      USD
             1 1000 USD                                                  1000
             3 1000 GBP                                               2013.19
             2 1000 INR                                                    24                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Need a sql query to get the difference between two timestamp in the format of hh:mm:ss.msec

    I have a database table where it keeps record of the transaction when it starts at StartTime and when it ends at EndTime. Both these entries are having the timestamp entries. Say for example, I have a tuple with Entries like 'Transaction A' starts at '2014-05-07
    20:55:03.170' and ends at '2014-05-08 08:56:03.170'. I need to find the difference between these two timestamps and my expected output is 12:01:00.000. Let me know how to achieve this ? 

    Hi,
    You can use below script which calculates difference as DD:HH:MM:SS. You can modify the same:
    DECLARE @startTime DATETIME
    DECLARE @endTime DATETIME
    SET @startTime = '2013-11-05 12:20:35'
    SET @endTime = '2013-11-10 01:22:30'
    SELECT [DD:HH:MM:SS] =
    CAST((DATEDIFF(HOUR, @startTime, @endTime) / 24) AS VARCHAR)
    + ':' +
    CAST((DATEDIFF(HOUR, @startTime, @endTime) % 24) AS VARCHAR)
    + ':' +
    CASE WHEN DATEPART(SECOND, @endTime) >= DATEPART(SECOND, @startTime)
    THEN CAST((DATEDIFF(MINUTE, @startTime, @endTime) % 60) AS VARCHAR)
    ELSE
    CAST((DATEDIFF(MINUTE, DATEADD(MINUTE, -1, @endTime), @endTime) % 60)
    AS VARCHAR)
    END
    + ':' + CAST((DATEDIFF(SECOND, @startTime, @endTime) % 60) AS VARCHAR),
    [StringFormat] =
    CAST((DATEDIFF(HOUR , @startTime, @endTime) / 24) AS VARCHAR) +
    ' Days ' +
    CAST((DATEDIFF(HOUR , @startTime, @endTime) % 24) AS VARCHAR) +
    ' Hours ' +
    CASE WHEN DATEPART(SECOND, @endTime) >= DATEPART(SECOND, @startTime)
    THEN CAST((DATEDIFF(MINUTE, @startTime, @endTime) % 60) AS VARCHAR)
    ELSE
    CAST((DATEDIFF(MINUTE, DATEADD(MINUTE, -1, @endTime), @endTime) % 60)
    AS VARCHAR)
    END +
    ' Minutes ' +
    CAST((DATEDIFF(SECOND, @startTime, @endTime) % 60) AS VARCHAR) +
    ' Seconds '
    Reference:
    http://sqlandme.com/2013/12/23/sql-server-calculating-elapsed-time-from-datetime/
    - Vishal
    SqlAndMe.com

Maybe you are looking for

  • ODBC store procedure NQSSetSessionValue() in OBIEE 10.1.3.2

    How can I call the stored procedure NQSSetSessionValue() to set a session variable? There is an option in Oracle BI Admin tool in the Variable property : Enable any user to set the value. My requirement is set a session variable programtically in the

  • Inbox is only showing a spinning wheel

    Hi, My mail in the macbook pro stopped receiving mail.  All I see is a spinning wheel next to the inbox.  Can anyone give me some technical advice?

  • Unable to configure SSL certificate on Apex

    I am trying to configure ssl certificate in one apex application. http://docs.tpu.ru/docs/oracle/en/oas/10.1.2.0.0/web.1012/b14007/ssl.htm#i1031859 as per the above document first step is create a wallet with SSL certificate information. While creati

  • Drill back to planning using ODI

    Hi Experts !! My Source is from oracle tables(11g) which I able to reverse engineer in ODI 11g and load the data to Hyperion planning application 11.1.2 . Now the requirement is that they need drill through/back from planning to the source oracle tab

  • Refresh time of workflow items

    Workflows items which come in task folder of SAP Portal take around 15-20 seconds to get refreshed. Is there any way to reduce the time taken to refresh? Is it suggestible?