SQL query problem finding difference in documents

Hi all
I use oracle 10g. I need emergency aid to find the difference in documents based on the date:

I have sales of the table as below:

seller SALES_COUNT DATE
JOHN 20 04/01/2012
DENNY 15 04/01/2012
JOHN 30 04/02/2012
DENNY 30 04/02/2012
JOHN 45 04/03/2012
DENNY 50 04/03/2012


SALES_COUNT is up to man including the date of sale. Its similar cumulative number. John has total sales of 01/04/2012 to 03/04/2012 is 50 and same case for Denny. This SALES_COUNT will keep increasing with dates as sales continue to add in the table for each salesperson.
But I want to have seprate for each seller counties.
for example: JOHN SALES_COUNT 04/02/2012 is 30-20 = 10
JOHN SALES_COUNT 03/04/2012 is 45-30 = 15
DENNY SALES_COUNT, 02/04/2012 is 30-15 = 15
JOHN SALES_COUNT 03/04/2012 is 50-30 = 20

Please help me with this scenario and let me know if you need clarification. I would much appreciate your help.

Thank you.

This gives you what you want?

with t as (
     select 'JOHN' salesman, 20 sales_count, to_date('04/01/2012', 'mm/dd/yyyy') sale_date from dual
     union all
     select 'DENNY' salesman, 15 sales_count, to_date('04/01/2012', 'mm/dd/yyyy') sale_date from dual
     union all
     select 'JOHN' salesman, 30 sales_count, to_date('04/02/2012', 'mm/dd/yyyy') sale_date from dual
     union all
     select 'DENNY' salesman, 30 sales_count, to_date('04/02/2012', 'mm/dd/yyyy') sale_date from dual
     union all
     select 'JOHN' salesman, 45 sales_count, to_date('04/03/2012', 'mm/dd/yyyy') sale_date from dual
     union all
     select 'DENNY' salesman, 50 sales_count, to_date('04/03/2012', 'mm/dd/yyyy') sale_date from dual
)
select salesman,
       sales_count sales_todate,
       sale_date,
       sales_count - lag(sales_count, 1, 0) over (partition by salesman order by sale_date) daily_sales
from t

SALESMAN,SALES_TODATE,SALE_DATE,DAILY_SALES
DENNY,15,4/1/2012,15
DENNY,30,4/2/2012,15
DENNY,50,4/3/2012,20
JOHN,20,4/1/2012,20
JOHN,30,4/2/2012,10
JOHN,45,4/3/2012,15
      

Tags: Database

Similar Questions

  • SQL query to find the total number of source based nonsource passangersbetween source and destination station and passenger station on the same chekindate

    Hello

    SQL query to find the total number of source based nonsource passangersbetween source and destination station and passenger station on the same chekindate.

    Please help on this script and let me know if you need more details.

    ---

    You use a SELECT statement.  Let me know if you need more details.

  • cache of SQL query problem

    I'm seeing the log file to manage the sql query sessions in the responses. I see that if we run the same report multiple times, the sql query is displayed only the first time. Second time if I run it is not displayed. If I make a new report with diff columns selected, it gives me the sql code then. Where can I put this option to display the sql query whenever I run a report, even if it's the same report executed several times. Is this caching problem?

    It should not... You have disabled the "Cache" on the physical layer for this table? If you go to the Advanced tab, is the option "ignore the cache Oracle BI" checked?

  • A difficult dynamic SQL query problem

    Hi all

    I have a very interesting problem to work:

    We have this special table defined as follows:

    CREATE TABLE sales_data)
    sales_id NUMBER,
    NUMBER of sales_m01
    NUMBER of sales_m02
    NUMBER of sales_m03
    NUMBER of sales_m04
    NUMBER of sales_m05
    NUMBER of sales_m06
    NUMBER of sales_m07
    NUMBER of sales_m08
    NUMBER of sales_m09
    NUMBER of sales_m10
    NUMBER of sales_m11
    NUMBER of sales_m12
    sales_prior_yr NUMBER);
    /

    Columns ' sales_m01... sales_m12' represents aggregated monthly sales, what "sales_m01" is translated by "sales for the month of January, January is the first month,"sales_m02"in sales for the month of February and so on.»

    The problem I encounter is that we have a project that requires that a parameter is passed to a stored procedure that represents the number of months which is then used to create a SQL query with aggregations of next mandatory field, which depends on the parameter passed:

    Example 1: entry of parameter: 4
    Should be built dynamically to SQL query:

    SELECT
    Sum (sales_m04) as CURRENT_SALES,
    Sum (sales_m01 + sales_m02 + sales_m03 + sales_m04) SALES_YTD
    Of
    sales_data
    WHERE
    sales_id = '0599768';

    Example 2: input parameter: 8
    Should be built dynamically to SQL query:

    SELECT
    Sum (sales_m08) as CURRENT_SALES,
    SUM (sales_m01 + sales_m02 + sales_m03 + sales_m04 +)
    sales_m05 + sales_m06 + sales_m07 + sales_m08) SALES_YTD
    Of
    sales_data
    WHERE
    sales_id = '0599768';


    So in a sense, the contents of SUM(sales_m01...n) would vary according to the parameter, which must be a number between 1... 12 what is a month, which in turn corresponds to a range of real field on the table itself. The resulting dynamic query should include only those columns/fields in the table that is within the range given by the input parameter and does not account for all the other columns/fields.

    Any solution is greatly appreciated.

    Thank you.
    SQL> declare
      cols long;
      param integer := 6;
      sales_id integer := 0599768;
    begin
      for i in 1..param loop
        cols := cols || 'sales_m' || to_char(i, 'fm00') || '+';
      end loop;
    
      dbms_output.put_line('select sum(sales_m'||to_char(param,'fm00')||') current_sales, sum(' || rtrim(cols,'+') || ') sales_ytd from sales_data WHERE sales_id = :1');
    end;
    /
    select sum(sales_m06) current_sales, sum(sales_m01+sales_m02+sales_m03+sales_m04+sales_m05+sales_m06) sales_ytd from sales_data WHERE sales_id = :1
    PL/SQL procedure successfully completed.
    

    Now it should be obvious:
    Instead of dbms_output OPEN a refcursor:

    SQL> declare
      cols long;
      param integer := 6;
      sales_id integer := 0599768;
      cur sys_refcursor;
    begin
      for i in 1..param loop
        cols := cols || 'sales_m' || to_char(i, 'fm00') || ',';
      end loop;
    
      open cur for 'select sum(sales_m'||to_char(param,'fm00')||') current_sales, sum(' || rtrim(cols,',') || ') sales_ytd from sales_data WHERE sales_id = :1' using sales_id;
      .....
    end;
    /
    

    Published by: michaels2 on July 26, 2009 09:49

    replaced ',' with ' + '.

  • SQl query to find out time between the different lines of transactions

    (See both images from an attachment to get the clear picture of the data and understand the question correctly.)

    I have a set of data like this in one of my paintings. (This is a simple representation of the original data.)

    Reference table1.jpg

    Id        | Type               | Value | Start_date | End_date

    ----------------------------------------------------------------------------------------------------------------------

    ZTR0098 | ALLOW | 0 | 1 JUN | 2 JUN |

    ZTR0098 | ADTAX | 0 | 1 JUN | 2 JUN |

    ZTR0098 | MXTAX | 0 | 1 JUN | 9 JUN |

    ZTR0098 | ALLOW | 4. 3 JUN | 15 JUN |

    ZTR0098 | ADTAX | 44.00 | 3 JUN | 17-JUNE |

    ZTR0098 | MXTAX | 2. 10 JUN | 17-JUNE |

    ZTR0098 | ALLOW | 5. 16-JUNE | 20 JUN |

    ZTR0098 | ADTAX | 55,34 | 18 JUN | 22 JUN |

    ZTR0098 | MXTAX | 1. 18 JUN | 25 JUN |

    ZTR0098 | MXTAX | 6. 26 JUN | 31 AUG |

    ZTR0098 | ADTAX | 20.09. 23 JUN | 23 JUL |

    ZTR0098 | ALLOW | 8. 21 JUN | 31 AUG |

    ZTR0098 | ADTAX | 45. 24 JUL | 31 AUG |

    each line has a type and a rasthaus id to it. ID belongs to other parent tables. the value of each type is given, and the validity of each value is followed by a field start_date and end_date.

    All values start from 1 - JUN and expires on 31 - AUG. Now my requirement is to obtain a report that gives three columns for three different types (ALLOW, ADTAX and MXTAX) with combination of unique values in the effective time interval. Let me put the result below.

    Reference table2.jpg

    Id         | ALLOW | ADTAX | MXTAX |  Start_date | End_date

    --------------------------------------------------------------------------------------------------------------------------------------------------

    ZTR0098 | 0 | 0 | 0 | 1 JUN | 2 JUN |

    ZTR0098 | 4. 44.00 | 0 | 3 JUN | 9 JUN |

    ZTR0098 | 4. 44.00 | 2. 10 JUN | 15 JUN |

    ZTR0098 | 5. 44.00 | 2. 16-JUNE | 17-JUNE |

    ZTR0098 | 5. 55,34 | 1. 18 JUN | 20 JUN |

    ZTR0098 | 8. 55,34 | 1. 21 JUN | 22 JUN |

    ZTR0098 | 8. 20.09. 1. 23 JUN | 25 JUN |

    ZTR0098 | 8. 20.09. 6. 26 JUN | 23 JUL |

    ZTR0098 | 8. 45. 6. 23 JUL | 31 AUG |

    As you can see there are no duplicate rows for a combination of (ALLOW, ADTAX and MXTAX) with their respective dates in force. resulting in the above table. the first step is to convert lines to the column which is pretty obvious to do that by grouping on start_date and end_date colum, but the real deal is the time interval during which the combination of the values (ALLOW, ADTAX, and MXTAX) has remained constant.

    I wrote under query using Group by.

    Select

    ID,

    NVL (max (decode (type, "ALLOW", value)), 0) as ALLOW

    NVL (max (decode (type, 'ADTAX', value)), 0) as ADTAX

    NVL (max (decode (type, 'MXTAX', value)), 0) as MXTAX

    Start_date,

    End_date

    from my_table

    Group of start_date, end_date, id

    start_date, end_date

    the results it gives are like this:

    Reference table3.jpg

    Id       | ALLOW | ADTAX | MXTAX |  Start_date | End_date

    ------------------------------------------------------------------------------------------------------------------------------------------------

    ZTR0098 | 0 | 0 | 0 | 1 JUN | 2 JUN |

    ZTR0098 | 0 | 0 | 2. 1 JUN | 9 JUN |

    ZTR0098 | 4. 0 | 0 | 3 JUN | 15 JUN |

    ZTR0098 | 0 | 44.00 | 0 | 3 JUN | 17-JUNE |

    ZTR0098 | 0 | 0 | 2. 10 JUN | 17-JUNE |

    ZTR0098 | 5. 0 | 0 | 16-JUNE | 20 JUN |

    ZTR0098 | 0 | 55,34 | 0 | 18 JUN | 22 JUN |

    .   .

    . .

    like wise

    but I'm not able to determine the time intervals by using the SQL query.

    with

    Table1 as

    (select the id 'ZTR0098', 'ALLOW' type, 0 val, to_date('1-JUN','dd-MON') start_date, end_date Union to_date('2-JUN','dd-MON') double all the)

    Select 'ZTR0098', 'ADTAX', 0, to_date('1-JUN','dd-MON'), to_date('2-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'MXTAX', 0, to_date('1-JUN','dd-MON'), to_date('9-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'ALLOW', 4, to_date('3-JUN','dd-MON'), to_date('15-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'ADTAX', 44.00, to_date('3-JUN','dd-MON'), to_date('17-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'MXTAX', 2, to_date('10-JUN','dd-MON'), to_date('17-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'ALLOW', 5, to_date('16-JUN','dd-MON'), to_date('20-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'ADTAX', 55.34, to_date('18-JUN','dd-MON'), to_date('22-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'MXTAX', 1, to_date('18-JUN','dd-MON'), to_date('25-JUN','dd-MON') of all the double union

    Select 'ZTR0098', 'MXTAX', 6, to_date('26-JUN','dd-MON'), to_date('31-AUG','dd-MON') of all the double union

    Select 'ZTR0098', 'ADTAX', 20.09, to_date('23-JUN','dd-MON'), to_date('23-JUL','dd-MON') of all the double union

    Select 'ZTR0098', 'ALLOW', 8, to_date('21-JUN','dd-MON'), to_date('31-AUG','dd-MON') of all the double union

    Select 'ZTR0098', 'ADTAX', 45, to_date('24-JUL','dd-MON'), to_date('31-AUG','dd-MON') of the double

    ),

    days like

    (select level - 1 dte + to_date('1-JUN','dd-MON')

    of the double

    connect by level<= to_date('31-aug','dd-mon')="" -="" to_date('1-jun','dd-mon')="" +="">

    )

    Select id, allow, adtax, mxtax, min (dte) start_date, max (dte) end_date

    (select ID, dte, max (allow) allow, max (adtax) adtax, max (mxtax) mxtax,

    ROW_NUMBER() over (order by dte) row_number() - courses (partition by order max (allow), max (adtax), max (mxtax) by dte) gr

    go (select id, dte,

    -case when type = 'ALLOW' and dte between start_date and end_date then end val 0 otherwise allow.

    -case when type = "ADTAX" and dte between start_date and end_date then val 0 otherwise end adtax.

    -case when type = "MXTAX" and dte between start_date and end_date then val 0 otherwise end mxtax

    Table 1 t,

    days d

    where d.dte between t.start_date and t.end_date

    )

    Group by id, dte

    )

    Group by id, gr, allow, adtax, mxtax

    order by id, gr

    ID ALLOW ADTAX MXTAX START_DATE END_DATE
    ZTR0098 0 0 0 01/06/2015 02/06/2015
    ZTR0098 4 44 0 03/06/2015 09/06/2015
    ZTR0098 4 44 2 10/06/2015 15/06/2015
    ZTR0098 5 44 2 16/06/2015 17/06/2015
    ZTR0098 5 55,34 1 18/06/2015 20/06/2015
    ZTR0098 8 55,34 1 21/06/2015 22/06/2015
    ZTR0098 8 20.09 1 23/06/2015 25/06/2015
    ZTR0098 8 20.09 6 26/06/2015 23/07/2015
    ZTR0098 8 45 6 24/07/2015 31/08/2015

    Concerning

    Etbin

  • SQL query problem - (internal has not managed to the outer query)

    Hi all:

    Here is my SQL query:
    SELECT RD.SITE,
      ROUND(
      (SELECT COUNT (DISTINCT PB.EMP_ID)
      FROM BOOK PB
      WHERE PB.EMP_ID IN
        (SELECT PB.EMP_ID FROM BOOK PB
        )
      ) /
      (SELECT COUNT (DISTINCT PB.EMP_ID)
      FROM BOOK PB
      WHERE PB.EMP_ID IN
        (SELECT PB.EMP_ID FROM BOOK PB
    WHERE MO.QUALIFIER > 4
        )
      )* 100, 2) AS PERCENTAGE
    FROM BOOK PB
    LEFT JOIN POSITION MO
    ON PB.EMP_ID = PO.EMP_ID
    INNER JOIN PHYS_LOCATION RD
    ON MO.HOUSED         = RD.SITE_ID
    WHERE MO.ACTUAL_END IS NULL
    GROUP BY RD.SITE;
    Why am I the overall percentage of all Sites as opposed to each percentage calculation for each site. I've grouped by Rd. SITE, so I assume he would calculate the percentages for each site. What I've done wrong?

    Thank you for your help.

    AquaNX4 wrote:
    Hi all:

    Here is my SQL query:

    SELECT RD.SITE,
    ROUND(
    (SELECT COUNT (DISTINCT PB.EMP_ID)
    FROM BOOK PB
    WHERE PB.EMP_ID IN
    (SELECT PB.EMP_ID FROM BOOK PB
    )
    ) /
    (SELECT COUNT (DISTINCT PB.EMP_ID)
    FROM BOOK PB
    WHERE PB.EMP_ID IN
    (SELECT PB.EMP_ID FROM BOOK PB
    WHERE MO.QUALIFIER > 4
    )
    )* 100, 2) AS PERCENTAGE
    FROM BOOK PB
    LEFT JOIN POSITION MO
    ON PB.EMP_ID = PO.EMP_ID
    INNER JOIN PHYS_LOCATION RD
    ON MO.HOUSED         = RD.SITE_ID
    WHERE MO.ACTUAL_END IS NULL
    GROUP BY RD.SITE;
    

    Why am I the overall percentage of all Sites as opposed to each percentage calculation for each site. I've grouped by Rd. SITE, so I assume he would calculate the percentages for each site. What I've done wrong?

    It's what you're asking. Your subquery scalar to get the percentage is not restricted by the current site. Add columns to filter to restrict the values selected for the calculation

    Published by: riedelme on May 8, 2013 07:26

  • SQL query to find approved projects that are open

    Hello

    Can anyone provide a SQL query which will display only the approved projects that are open.

    Thank you

    Titas

    Try this

    Select project NAME of pa_projects_all
    where project_status_code = 'APPROVED '.
    and NVL (CLOSED_DATE, SYSDATE + 1) > SYSDATE

    Thank you
    Pradeep

  • SQL query to find out the version of discoverer

    Hello
    As a developer, is there a query sql DB the dorsal (or script) that can be run on DB to find out the version of Oracle Discoverer installed?
    The query will be different if the discoverer is used with the Oracle Applications (R12.1.3) compared to a Scout running on a plain stand alone Oracle database (Oracle applications not)?

    Thank you
    GG.

    Hello gg

    The VER_NAME and the VER_DESCRIPTION are usually never filled and can be ignnored.

    The VER_RELEASE is the NLY version as you rightly summised. This version is 100% compatible with the discoverer 11g and if you already have it you can go from 10g to 11g without changing anything in the EUL

    VER_MIN_CODE_VER is the minimum version of Oracle Discoverer which can be used with this EUL. In this case, 10.1.2.45.20 is 10g Release 2

    VER_EUL_TIMESTAMP is the date and time, this version of the EUL was published by Oracle - again you can ignore it

    Important fields are VER_RELEASE and VER_MIN_CODE_VER

    Hope this helps
    Best wishes
    Michael

  • SQL Query help find albums from sale

    Hi Experts,

    I have the following data and the need to find the book Top sold in each type.

    Book Type QTY

    20Help the3
    10Kitchen1
    5Navigation2
    30Help the4

    Please let me how can know we get this simple SQL help?

    Thank you

    Bharat

    Hello

    Bharat Hegde wrote:

    Hi all

    I tried to use Dense_rank as below. But it gives me the top selling books. I need high library in each type...

    This looks like a job for 'PARTITION BY type

    For example:

    WITH got_rnk AS

    (

    SELECT b.bid, b.type

    SUM (o.quantity) AS total_quantity

    DENSE_RANK () OVER ( PARTITION BY b.type

    ORDER OF SUM (o.quantity) / / DESC

    ) AS rnk

    B BOOK

    o order1

    WHERE b.bid = o.bid

    GROUP BY b.bid, b.type

    )

    SELECT total_quantity, type submission

    OF got_rnk

    WHERE rnk = 1

    ;

    . Aggregate functions (such as the SUM, above) are calculated before analytical functions, so an analytic function (such as DENSE_RANK above) may depend on an aggregate function; you don't need a separate subquery for that.

  • SQL Query search line differences

    Hi all!

    It will probably be a super easy question and a solution for someone.  Here's my scenario.

    • 2 tables (Table_1, Table_2)
    • 3 columns (A, B, C)
    • Table_1 unless Table_2 records, if I want to find records in Table_2 who aren't in Table_1
      • I don't like to find the records that are in Table_1 and Table_2
    • I'll do the comparison with column a.

    For simplicity, lets say a 10 lines total Table_1 and Table_2 15 total of lines.  He must only find 5 rows that are not in Table_1 and Table_2.  So, if I add the number of records found in Table_2 Table_1 total records, then I would have at least the same amount of records in Table_1 and Table_2, if not more.  Also, is there a way where I can insert the differences between the lines found in a 3rd table "to stop"?

    The example is provided below.

    Table_1

    A | B | C

    1. Bonneau | something

    2. Bonneau | something

    3. Bonneau | something

    4. Bonneau | something

    5. Bonneau | something

    Table_2

    A | B | C

    1. Bonneau | something

    3. Bonneau | something

    5. Bonneau | something

    6. Bonneau | something < = difference

    7. Bonneau | something < = difference

    In fact, there are millions of records in both tables.  I have a solution for this, but it would require me to do... Export results from Table_1 and Table_2.  Open the two results in Excel and run a macro to know the difference.  Once I found the difference, I save and import the results into the 3rd table 'intermediate '.

    Any help would be great!  Thank you!

    Hello

    You can use a subquery NOT EXISTS or NOT IN the for.

    For example, scott.dept and scott.emp are assimilated by deptno.  To find all the rows in the dept who do not have a corresponding row in the emp:

    SELECT *- or all of the columns that you want to

    OF scott.dept

    WHERE deptno NOT IN ((in English only)

    SELECT DeptNo

    FROM scott.emp

    WHERE deptno IS NOT NULL - if necessary

    )

    ;

    When you use a NOT IN subquery, check that the subquery cannot produce NULL values.

    I hope that answers your question.

    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.  Include an example where the column has is identical in the two tables, but columns B and C are not.

    Post your best attempt (use one of the solutions of publication) and specify where it's getting incorrect results, explain, using specific examples, how you get the right results from data provided in these places.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • SQL query to find the value of a column as well!

    Hi all

    I have to write a query that needs to retrieve the value of a column in table B if the column value is Null in the Table A. Please find below the sample table.

    Table A:
    *******
    EmpNumber ID
    ------------------------------
    1 12345
    2
    3 14789
    4
    5 74563

    Table B:
    *******
    EmpNumber ID
    -----------------------------
    1 12345
    2 78451
    3 14789
    4 12212
    5 74563

    In the table a second and third rows have value for EmpNumber. The query should look for table B for EmpNumber value. Please advise me to make this request.

    Thank you

    This?

    select      a.id,
         nvl(a.empnumber,b.empnumber) empnumber
    from tabA a, tabB b
    where a.id = b.id;
    
  • select SQL query problem

    Hi friends,

    I have a view called 'risk_efforts' with the field user_id, user_name, wknd_dt, Etiquettemois, prod_efforts, unprod_efforts.

    Name Type
    -------------- -------------
    ROW_ID NUMBER
    USER_ID VARCHAR2 (14)
    VARCHAR2 (50) USER_NAME
    WKND_DT VARCHAR2 (8)
    ETIQUETTEMOIS VARCHAR2 (250)
    NUMBER OF PROD_EFFORTS
    NUMBER OF UNPROD_EFFORTS

    data are like this:
    When there is some data in prod_efforts, unprod_efforts will be null
    When there is some data in unprod_efforts, prod_efforts will be null

    for example:

    USER_ID, USER_NAME WKND_DT ETIQUETTEMOIS PROD_EFFORTS UNPROD_EFFORTS
    G666999 20100403 GTest KILLS null 3
    G666999 GTest 20100403 Mar 14 null

    now I want to combine these 2 rows in i.e 1 row o/p should be like this

    USER_ID, USER_NAME WKND_DT ETIQUETTEMOIS PROD_EFFORTS UNPROD_EFFORTS
    G666999 20100403 GTest KILLS 14 3

    I tried all combinations but couldn't make the query. Please help me with the exact SQL select query.

    Thank you
    Girish

    Welcome to the forum.

    First read this:

    Emergency in online messages

    Second, it is always helpful to provide the following information:

    1. oracle version (SELECT * FROM V$ VERSION)
    2. examples of data in the form to CREATE / INSERT commands.
    3. expected results
    4 explanation of the expected results (alias "business logic")
    5. use.

     tags for #2 and #3. See FAQ (Link on top right side) for details.
    
    You have provided #3 and #4. However with no usable form of sample data forum members will often not respond as quickly as they could if you provided #2.
    
    I'm just wagering a guess here but what about this:
    

    SELECT ROW_ID
    USER_ID
    WKND_DT
    ETIQUETTEMOIS
    MAX (PROD_EFFORTS) AS PROD_EFFORTS
    MAX (UNPROD_EFFORTS) AS UNPROD_EFFORTS
    OF RISK_EFFORTS
    ROW_ID GROUP
    USER_ID
    WKND_DT
    ETIQUETTEMOIS

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    
  • Recordset SQL query problem

    Hi there I try to execute the following set of records-

    < %
    Dim LiveProperties
    Dim LiveProperties_cmd
    Dim LiveProperties_numRows

    Set LiveProperties_cmd = Server.CreateObject ("ADODB.Command")
    LiveProperties_cmd. ActiveConnection = MM_recruta2_STRING
    LiveProperties_cmd.CommandText = "SELECT COUNT (PropertyID) As NumberofProperties, propertylive, propertylive WHERE propertylocation = 'y' FROM dbo.easytoletproperty GROUP BY propertylocation.
    LiveProperties_cmd. Prepared = true

    Set LiveProperties = LiveProperties_cmd. Run
    LiveProperties_numRows = 0
    % >

    However, when I test this situation, I get the following error:

    Provider Microsoft OLE DB for SQL Server error '80040e14 '.

    Incorrect syntax near the keyword 'FROM '.

    / PropertiesbyTown2.asp, line 358


    Any ideas as to what I did wrong?

    Thank you

    'Column 'dbo.easytoletproperty.propertylive' is invalid in the select list because it is not contained in the clause Group By or an aggregate function'

    Fix. You have used an aggregate function, then all other columns that are not part of an aggregate must be grouped together by using the group by clause.

  • SQL Query - to find users with the end of the responsibilities

    Oracle Apps worm: 11.5.10.2

    Oracle DB - 9i

    How can I list users and access given to them for a distribution Specifies any responsibility end being dated at the level of responsibility

    Sakshi,

    Try this, hope will solve your problem,

    Select a.user_name, a.description, c.RESPONSIBILITY_NAME, b.START_DATE, b.end_date
    fnd_user a.,
    B FND_USER_RESP_GROUPS_DIRECT,
    c fnd_responsibility_vl
    where a.user_id = b.user_id
    and b.RESPONSIBILITY_ID = c.RESPONSIBILITY_ID
    and a.user_id = 'ENTER_USER_ID';

    Thank you
    Anchorage :)

  • SQL query problem

    Hi all

    I have table T_TEST with column Date_Time and email...

    Select TO_CHAR(date_time,'DD-MON-YY HH:MM:SS') Date_Time, email T_TEST

    Date_Time E-mail
    1 JUNE 13 12:06:29[email protected]
    1 JANUARY 14 01:06:31[email protected]
    1ST FEBRUARY 14 03:00[email protected]
    1ST FEBRUARY 14 01:09[email protected]
    MARCH 2, 11 07:00[email protected]
    JUNE 9, 10 11:00[email protected]

    I need to later / recent DATA-data date time

    the final out put only on files

    Date_Time E-mail
    1ST FEBRUARY 14 03:00[email protected]

    Please help me on this...

    Hello

    Try it below:

    with t as

    (

    Select to_date (1 June 13 12:06:29 ',' DD-MON-YY HH12:MI:SS') Date_Time,' [email protected]' email of all the double union

    Select to_date (1 January 14 01:06:31 "," DD-MON-YY HH12:MI:SS'),' [email protected]' Union double all the

    Select to_date (1 February 14 03:00 "," DD-MON-YY HH12:MI:SS'),' [email protected]' Union double all the

    Select to_date (1 February 14 01:09 ',' DD-MON-YY HH12:MI:SS'),' [email protected]' of the double

    )

    Select to_char (date_time, "DD-MON-YY HH12:MI:SS) Date_Time, email from t where to_char (date_time," DD-MON-YY HH12:MI:SS) in (select to_char (max (date_time), "DD-MON-YY HH12:MI:SS") t);

    OUTPUT:

    DATE_TIME EMAIL

    --------------------------- --------------

    1st February 14 03:00 [email protected]

Maybe you are looking for

  • DVD

    I want to copy a dvd on my iMac, how do I do that

  • With the help of Mac Mini like laptop?

    Hi guys,. Can I use a Mac Mini as a laptop? I mean go to work every day and carry it in my bag, and then connect to a screen. What I mean if a Mac Mini is of solid construction, built to withstand move it every day. The life of a portable device, hah

  • Blue screen on Satellite C660

    My plant C660 - blue screen with the error message... "a break of clock has not received on a secondary processor in the allotted time interval. I've updated the bios and all the main drivers othe and removed the software. Any suggestions as to what

  • Convert PDF to Jpeg?

    Hello I look for ways display a pdf file in ICB with an external program to no success. I then looked in the conversion of a pdf file to an image file. I found many of them but none of them are free and they are exspensive. Is it possible to convert

  • EqualLogic MTU off line repl - data loading - errorno 13

    Try to load the data with a graphical interface of MTU, get the following error: "Data transfer operation might BNE start due to the follwing error: i/o on the volume error: OSError; [Errno 13] Permission denied. " What Miss me? Someone at - he seen