Creating SQL Query to determine similar customers

I have a table that contains two columns: CustomerID and ItemID.
There are 480 CustomerIDs and more than 5000 ItemIDs. The table shows what all items have been bought by each customer.
I need to write a procedure where i can determine which all customers are 'Like Customers' (It means if a Customer C1 buys Items A, B and C where another customer C2 buys A, B, C, D, E then we can say that C1 and C2 are 'Like Customers' since, they both
bought A, B, C.  It is also possible that both the customers bought B,C,D or C,D,E or any other combination)
I would also like to know whether this kind of problem can be better solved in SSMS or SQL Server Business Intelligence Devp Studio (using data mining techniques)?

For future reference, posting DDL and providing sample data makes it easier to answer your questions...
Anyway, based on the size of your table, simple T-SQL should do the trick.
-- a little test data.
CREATE TABLE #temp (
CustomerID INT,
ProductID INT
INSERT #temp (CustomerID,ProductID) VALUES
(1,1),
(1,2),
(1,3),
(1,4),
(1,5),
(2,4),
(2,5),
(2,6),
(2,7),
(3,2),
(3,3),
(3,8),
(3,9),
(4,10),
(4,11),
(4,12),
(4,13),
(5,1),
(5,2),
(5,12),
(5,13),
(6,1),
(6,5),
(6,7),
(6,10),
(7,1),
(7,2),
(7,3),
(7,4),
(7,5)
-- the actual solution
SELECT
t1.CustomerID AS Customer1,
t2.CustomerID AS Customer2,
COUNT(*) AS CommonItemCount
FROM
#temp t1
JOIN #temp t2
ON t1.CustomerID < t2.CustomerID
AND t1.ProductID = t2.ProductID
GROUP BY
t1.CustomerID,
t2.CustomerID
HAVING
COUNT(*) >= 2 -- set this to whatever threashold value you deem as "similar"
ORDER BY
t1.CustomerID,
t2.CustomerID
HTH,
Jason
Jason Long

Similar Messages

  • Creating sql query using 3 tables

    There is database (supposed to be relational but it is not) and
    I cannot change the tables and it is very difficult to create SQL query.
    Please, help!
    First table T1
    a1 char 20
    time timestamp
    a2 char 7 (the same as t2.a2 when is trimmed)
    a3 number 5,0
    a4 number 8,4
    a5 number 7,3
    Second table T2
    a2 char 15
    b1 number 1,0
    b2 char 1,0
    b3 char 4
    a3 number 5,0
    Third table T3
    b3 char 4
    c1 char 4
    c2 number 7,3
    c3 number 8,4
    So, I need to create query (is it possible at all!?) from those 3 tables (a1, a2, b1,b2,b3, a4, a5, c2,c3
    where time is within interval (from, to), a3 in interval (1,2,3,4), t2.b3=t3.b3, t1.a2=t2.a2
    group by or sorted by a1, then, a2.
    Any suggestion is welcome!
    Thanks!
    By the way, I will use this query in Crystal Reports.

    As I already mentioned, I received another conditions for the query, and when I create a new one, I
    First table T1
    a1 number 5,0
    a2 char 7 (the same as t2.a2 when is trimmed)
    a3 number 8,4
    a4 number 7,3
    a_time timestamp
    Second table T2
    a2 char 15
    b1 number 1,0
    b2 char 1,0
    b3 char 4
    b4 char 4
    Third table T3
    c1 char 4
    c2 number 7,3
    c3 number 8,4
    b3 char 4
    where if c1='MIN' c2, c3 return min values,
    and if c1='MAX' c2,c3 return max values
    SQL query:
    select t1.a1, t1.a2, t2.b1, t2.b2, t2.b3, t1.a3, t1.a4, t3.c1,
    t3.c2, t3.c3, t2.b4
    from t1, t2, t3
    where (TRIM(t1.a2)=TRIM(t2.a2)
    and t1.a1=19
    and ((to_char(t1.a_time, 'YYYY-MM-DD') >= '2006-03-15')
    and (to_char(t1.a_time, 'YYYY-MM-DD') <= '2006-03-16')))
    and t3.b3=t2.b3)
    order by t1.a_time
    Result set:
    a1, a2, b1, b2, b3, a3, a4, c1('MAX'), c2', c3', b4
    a1, a2, b1, b2, b3, a3, a4, c1('MIN'), c2", c3", b4
    So when I executed SQL query it returns 2 rows for the same a2.
    I want to get 1 row for each a2 together with c3 (c4) min and c3 (c4) max values.
    How to name columns for c2 min and c2 max (the same for c3) in order to retreive 1 row per a2 value, something like this:
    a1, a2, b1, b2, b3, a3, a4, c2min, c2max, c3min, c3max, b4
    Thanks

  • How to create sql query for item master with operator LIKE with variables?

    hi all,
    How to create sql query for item master with
    operator LIKE(Contains,Start With,End With) with variables using query generator in SAP B1 ?
    Jeyakanthan

    Hi Jeyakanthan,
    here is an example (put the like statement into the where field)
    SELECT T0.CardCode, T0.CardName FROM OITM T0 WHERE T0.CardName Like '%%test%%'
    The %% sign is a wildcard. If you need start with write 'test%%' and otherwise ends with '%%test'. For contains you need '%%test%%'. You also could combinate this statements like 'test%%abc%%'. This means starts with test and contains abc.
    Regards Steffen

  • Fail to create SQL query report because of ORA-00923

    Hi expert,
    I would like to SQL query report using the following query:
    select min(identified_date) first_identified,
    max(actual_COMPLETE) last_closed,
    count(id) total_issues,
    sum(decode(status,'Open',1,0)) open_issues,
    sum(decode(status,'Pending',1,0)) pending_issues,
    sum(decode(status,'Resolved',1,0)) closed_issues,
    sum(decode(status,'Will Not Resolve',1,0)) not_resolve_issues,
    sum(decode(status,
    'Open',decode(priority,null,1,0),
    0)) open_no_prior,
    sum(decode(status,
    'Open',decode(priority,1,1,0),
    0)) open_prior_1,
    sum(decode(status,
    'Open',decode(priority,'2',1,0),
    0)) open_prior_2
    sum(decode(status,
    'Open',decode(priority,3,1,0),
    0)) open_prior_3,
    sum(decode(status,
    'Open',decode(priority,'4',1,0),
    0)) open_prior_4,
    sum(decode(status,
    'Open',decode(priority,5,1,0),
    0)) open_prior_5
    from SOFTPROJ_issues
    where project_id = :P83_PROJECT
    However, I got the following error during the steps of creation:
    1 error has occurred
    Query cannot be parsed, please check the syntax of your query. (ORA-00923: FROM¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿)
    I wonder why if it is getting the error because I could create the report with the following query without problems:
    select min(identified_date) first_identified,
    max(actual_COMPLETE) last_closed,
    count(id) total_issues,
    sum(decode(status,'Open',1,0)) open_issues,
    sum(decode(status,'Pending',1,0)) pending_issues,
    sum(decode(status,'Resolved',1,0)) closed_issues,
    sum(decode(status,'Will Not Resolve',1,0)) not_resolve_issues,
    sum(decode(status,
    'Open',decode(priority,null,1,0),
    0)) open_no_prior,
    sum(decode(status,
    'Open',decode(priority,1,1,0),
    0)) open_prior_1,
    sum(decode(status,
    'Open',decode(priority,3,1,0),
    0)) open_prior_3,
    sum(decode(status,
    'Open',decode(priority,5,1,0),
    0)) open_prior_5
    from SOFTPROJ_issues
    where project_id = :P83_PROJECT
    1 error has occurred
    Query cannot be parsed, please check the syntax of your query. (ORA-00923: FROM¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿)
    The difference is to add the followings only:
    sum(decode(status,
    'Open',decode(priority,'2',1,0),
    0)) open_prior_2
    sum(decode(status,
    'Open',decode(priority,'4',1,0),
    0)) open_prior_4,
    Does anyone have any idea to resolve the issue?
    Thanks in advance,
    Rui

    By putting a comma after open_prior_2:
    sum(decode(status,
    'Open',decode(priority,'2',1,0),
    0)) open_prior_2,Sima

  • CRM 2011: Creating SQL Query through MSCRM

    I have been asked to create some kind of query through SQL to find all open opportunities that have an activity record associated to that opportunity.
    Is this something that can be done through SQL? If so how do I join these two tables together?
    Thanks in advance

    You can do this in SQL, though you can also easily access this directly in CRM using Advanced Find.
    When accessing data via SQL, the supported route is to use the filtered views, rather than querying the tables directly. Each entity has an associated filtered view, for example the opportunity entity has a filtered view called FilteredOpportunity.
    You can join opportunities to activities using the regaridngobjectid field on the ActivityPointer entity
    select * from FilteredOpportunity o join FilteredActivityPointer a on o.opportunityid = a.regardingobjectid
    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

  • SQL query to determine Fiscal Week

    Hi Experts,
    I need to figure out the fiscal week for a specific datetime field based on the following requirements:
    1. A week Starts on Saturday and Ends on Friday.
    2. If Feb 1st of a given year is a Saturday, then week 1 will run from February 1st to February 7.
    3. If Feb 1st is not on a Saturday, then week 1 starts on the previous Saturday and ends on the first Friday of February
    Example 1: February 1st 2011 is on a tuesday so Week 1 will be from Jan 29th (Saturday) to February 4 (Friday). Week 52 of 2011 will be from Jan 21, 2012 (Saturday) to Jan 27, 2012 (Friday)
    Example 2: February 1st 2014 is on a Saturday so Week 1 will be from February 1st to February 7.
    I am looking for some sql or pl sql to get the week number. Any help will be greatly appreciated

    Hi,
    Welcome to the forum!
    Here's a PL/SQL function that returns the beginning of the fiscal year which contains a given date, in_date:
    CREATE OR REPLACE FUNCTION     fiscal_year_begin
    (       in_date       IN   DATE     DEFAULT SYSDATE
    RETURN     DATE
    DETERMINISTIC
    AS
         return_date          DATE;
         next_fiscal_year_begin     DATE;
    BEGIN
         return_date     := NEXT_DAY ( ADD_MONTHS ( TRUNC ( ADD_MONTHS (in_date, -1)
                                                    , 'YEAR'
                                    , 1
                                   ) - 7
                             , 'SATURDAY'
         IF  TO_CHAR (in_date, 'MM-DD') BETWEEN '01-26'
                                             AND     '01-31'
         THEN
              next_fiscal_year_begin := fiscal_year_begin (in_date + 7);
              IF  in_date >= next_fiscal_year_begin
              THEN
                   return_date := next_fiscal_year_begin;
              END IF;
         END IF;
         RETURN     return_date;
    END     fiscal_year_begin
    /Here's how it works:
    First, it finds the Saturday on or before February 1 in the same calendar year as in_date (or, if in_date is in January, the previous calendar year). In most cases, this will be the beginning of the fiscal year.
    The only exceptions are the days between January 26 amd January 31, inclusive. These days could be in the following fiscal year, so we check when that fiscal year begins and, if that date is less than in_date, the later date will be the one returned.
    To find the week number of a given date a_date, you can use this formula:
    1 + FLOOR ( (a_date - fiscal_year_begin (a_date))
              / 7
           )which finds how may days have passed since the beginning of the fiscal year, dvides by 7 to get the number of completed weeks (0-52), and adds 1 to get the number of the week in progress.
    You may want to write another function that does that forumula
    You could do the whole job in pure SQL, but it would be messy, and you'd have to copy that messy calculation in every query that used the fiscal year, which I imagine will be a lot of places.
    If the PL/SQL function proves to be too slow, you could use it to populate a table that contained the fiscal year starting points for all years in which you might be interested, and join to that table. You could also include every week in that table.
    Here's some code I wrote to test the function:
    CREATE TABLE table_x
    AS
    SELECT     DATE '2011-01-26' AS a_date     FROM dual     UNION ALL
    SELECT     DATE '2011-01-31'              FROM dual     UNION ALL
    SELECT     DATE '2011-02-01'              FROM dual     UNION ALL
    SELECT     DATE '2011-02-02'              FROM dual     UNION ALL
    SELECT     DATE '2011-02-08'              FROM dual;
    INSERT INTO  table_x (a_date)
    WITH   cntr     AS
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL <= 10
    SELECT     ADD_MONTHS (x.a_date, 12 * c.n)
    FROM             table_x    x
    CROSS JOIN        cntr           c
    ALTER SESSION     SET NLS_DATE_FORMAT     = 'DD-Mon-YYYY Day';
    SELECT     a_date
    ,     fiscal_year_begin (a_date)     AS year
    ,     1 + FLOOR ( (a_date - fiscal_year_begin (a_date))
                    / 7
                )               AS week
    FROM     table_x
    ORDER BY  a_date;Output:
    A_DATE                YEAR                        WEEK
    26-Jan-2011 Wednesday 30-Jan-2010 Saturday          52
    31-Jan-2011 Monday    29-Jan-2011 Saturday           1
    01-Feb-2011 Tuesday   29-Jan-2011 Saturday           1
    02-Feb-2011 Wednesday 29-Jan-2011 Saturday           1
    08-Feb-2011 Tuesday   29-Jan-2011 Saturday           2
    26-Jan-2012 Thursday  29-Jan-2011 Saturday          52
    31-Jan-2012 Tuesday   28-Jan-2012 Saturday           1
    01-Feb-2012 Wednesday 28-Jan-2012 Saturday           1
    02-Feb-2012 Thursday  28-Jan-2012 Saturday           1
    08-Feb-2012 Wednesday 28-Jan-2012 Saturday           2
    26-Jan-2021 Tuesday   01-Feb-2020 Saturday          52
    31-Jan-2021 Sunday    30-Jan-2021 Saturday           1
    01-Feb-2021 Monday    30-Jan-2021 Saturday           1
    02-Feb-2021 Tuesday   30-Jan-2021 Saturday           1
    08-Feb-2021 Monday    30-Jan-2021 Saturday           2Whenever you post a question on this forum, it helps if you also post some sample data (CREATE TABLE and INSERT statements) and the results you want from that data, like I just did.

  • Need help creating SQL Query

    Hi,
    I have this table
    declare @t_date table(cut_off datetime)
    insert into @t_date
    select '20140930'
    union
    select '20140716'
    union
    select '20140715'
    union
    select '20140714'
    union
    select '20140627'
    union
    select '20140625'
    I need this result: Dates nearests to end of month
    In the table on example, I need this output
    2014-09-30
    2014-07-16
    2014-06-27
    Can anyone help me?
    Thanks a lot in advance.
    declare @t_date table(cut_off datetime)
    insert into @t_date
    select '20140930' --this is OK cause eom
    union
    select '20140716' --this is OK cause is the nearest to eom(07)
    union
    select '20140715' --this is KO cause is not the nearest to eom(07)
    union
    select '20140714' --this is KO cause is not the nearest to eom(07)
    union
    select '20140627' --this is OK cause is the nearest to eom(06)
    union
    select '20140625' --this is KO cause is not the nearest to eom(06)

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. You have no keys! Learn how to follow ISO-11179 data element naming conventions and formatting rules.
    Temporal data should use ISO-8601 formats. It is the only –- repeat, only -– format allowed in ANSI/ISO Standard SQL! Code should be in Standard SQL as much as possible and not local dialect. We would use the correct INSERT INTO syntax. 
    Oh, that silly “t_” is called a “tibble” and we laugh at it. 
    CREATE TABLE Foobar_Dates
    (foobar_date DATE NOT NULL PRIMARY KEY);
    INSERT INTO Foobar_Dates
    VALUES
    ('2014-06-25'),
    ('2014-06-27'),
    ('2014-07-14'),
    ('2014-07-15'),
    ('2014-07-16'),
    ('2014-09-30'),
    >> I need this result: for each month I need the date nearest to end of month <<
    Since SQL is a database language, we prefer to do look ups and not calculations. They can be optimized while temporal math messes up optimization. A useful idiom is a report period calendar that everyone uses so there is no way to get disagreements in the DML.
    Build good tools and re-use them! 
    The report period table gives a name to a range of dates that is common to the entire enterprise. 
    CREATE TABLE Month_Periods
    (month_name CHAR(10) NOT NULL PRIMARY KEY
       CHECK (month_name LIKE '[12][0-9][0-9][0-9]-[01][0-9]-00'),
     month_start_date DATE NOT NULL,
     month_end_date DATE NOT NULL,
      CONSTRAINT date_ordering
        CHECK (month_start_date < month_end_date),
    etc);
    These report periods can overlap or have gaps. I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the ISO-8601
    data format required by Standard SQL and it is language independent. 
    SELECT M.month_name, MAX(F.foobar_date), 
           OVER (PARTITION BY M.month_name)
      FROM Foobar_Dates AS F, 
           Month_Periods AS M 
     WHERE F.foobar_date BETWEEN M.month_start_date AND M.month_end_date;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • UCM Data Dictionary SQL Query for Determining IP Address

    Forum,
    I am trying to determine the IP address(es) of the UCM cluster servers.  Using the UCM Data Dictionary and tables such as 'processnode' will provide information such as
    procnodename                      description                isactive macaddr procnodeid systemnode typenodename typeprocessnode
    ================================= ========================== ======== ======= ========== ========== ============ ====================
    EnterpriseWideData                                           t                1          t          Subscriber   CUCM Voice/Video
    usa109-s4pub01                    UCM 10.0 Publisher         t                2          f          Publisher    CUCM Voice/Video
    usa109-s4sub01                    UCM 10.0 Subscriber        t                3          f          Subscriber   CUCM Voice/Video
    usa109-s4cup01.lab.shoregroup.com UC Presence 10.0 Publisher t                9          f          Publisher    CUCM IM and Presence
    usa109-s4cup02.lab.shoregroup.com UC Presence 10.0 Publisher t                11         f          Subscriber   CUCM IM and Presence
    'callmanager' table does not provide a field for IP...'processnode' only had 'ipv6name' field...
    If the node using DNS to resolve name-to-IP as shown above...I have not found a way to obtain the IP address of the UCM node itself.  I know I can go to the CLI of a node a issue a command to obtain...but I have not found a Data Dictionary table to obtain the results. 
    I am open for suggestions...thx.

    If, in CCMAdmin, you've got server hostnames rather than IP addresses, CallManager will use DNS to get the IP addresses of the other servers.
    GTG

  • Need a logic for creating SQL query

    Hi Experts,
    Could you please help me to get the follwing desired output . thanks
    Actual Data:
    ABC01-02
    XYZ02-03
    PQR78-79
    LMN1-5
    Expected/Desired Output:
    ABC01
    ABC02
    XYZ02
    XYZ03
    PQR78
    PQR79
    LMN1
    LMN5
    Please let me know if you need any further information. Thanks in Advance.
    Regards
    Raghav

    Hi!
    In case you would like to get all entries:
    WITH
        mylist AS (SELECT 'ABC01-02' AS val FROM dual UNION ALL
                   SELECT 'XYZ02-03' AS val FROM dual UNION ALL
                   SELECT 'PQR78-79' AS val FROM dual UNION ALL
                   SELECT 'LMN1-5' AS val FROM dual
        details AS (SELECT regexp_substr(val, '\D+') AS s,
                           to_number(regexp_substr(val, '\d+', 1, 1)) AS xfrom,
                           to_number(regexp_substr(val, '\d+', 1, 2)) AS xto,
                           lpad('0', length(regexp_substr(val, '\d+', 1, 2)), '0') as xpattern
                      FROM mylist
        lines AS (SELECT ROWNUM AS yrow FROM dual CONNECT BY ROWNUM < 100
    SELECT s || trim(to_char(yrow, xpattern)) AS xresult
      FROM details JOIN lines ON (xfrom <= yrow AND xto >= yrow)
    ORDER BY xresult;Result:
    ABC01
    ABC02
    LMN1
    LMN2
    LMN3
    LMN4
    LMN5
    PQR78
    PQR79
    XYZ02
    XYZ03Best regards,
    Matt
    Edited by: Matt Schulz on 27.02.2013 14:41
    Edited by: Matt Schulz on 27.02.2013 14:43

  • Resolve column names in a sql Query

    Hi Folks,
         I’m upgrading an application and there are database columns that have major changes that could affect production reports. I would like to survey v$SQL for a few days to see if these columns are affected. Here’s the problem.
    Looking at a SQL query to determine which columns are used is not nearly as easy as it sounds. Are there any oracle functions or 3rd party tools that can be used to list the columns used by a sql query? (this gets extremely tricky when subqueries become involved)
    For instance.
    select
    name, b.dep_id, employee_id
    From emp a
    Inner join v_department b on a.dep_id=b.dep_id
    Columns used:+
    Emp.name+
    Departments.dep_id (under the view)+
    Emp.employee_id+
    Emp.dep_id (from the join)+

    If you're on > 10g, you can use dbms_xplan with "all" option.
    It shows "column projection information" which is exactly what you want.
    UKJA@ukja102> set serveroutput on
    UKJA@ukja102>
    UKJA@ukja102> drop table t1 purge;
    Table dropped.
    Elapsed: 00:00:00.03
    UKJA@ukja102> create table t1(c1 int, c2 int);
    Table created.
    Elapsed: 00:00:00.03
    UKJA@ukja102>
    UKJA@ukja102> explain plan for
      2  select
      3    t1.c1, t1.c2, v.cnt
      4  from t1,
      5    (select /*+ no_merge */ c1, count(*) as cnt
      6        from t1
      7        group by c1) v
      8  where
      9    t1.c1 = v.c1
    10  ;
    Explained.
    Elapsed: 00:00:00.01
    UKJA@ukja102>
    UKJA@ukja102> @plan_all
    UKJA@ukja102> select * from table(dbms_xplan.display(null,null,'all'))
      2  /
    PLAN_TABLE_OUTPUT                                                              
    Plan hash value: 536125944                                                     
    | Id  | Operation            | Name | Rows  | Bytes | Cost (%CPU)| Time     |  
    |   0 | SELECT STATEMENT     |      |     1 |    52 |     6  (34)| 00:00:01 |  
    |*  1 |  HASH JOIN           |      |     1 |    52 |     6  (34)| 00:00:01 |  
    |   2 |   TABLE ACCESS FULL  | T1   |     1 |    26 |     2   (0)| 00:00:01 |  
    |   3 |   VIEW               |      |     1 |    26 |     3  (34)| 00:00:01 |  
    |   4 |    HASH GROUP BY     |      |     1 |    13 |     3  (34)| 00:00:01 |  
    |   5 |     TABLE ACCESS FULL| T1   |     1 |    13 |     2   (0)| 00:00:01 |  
    Query Block Name / Object Alias (identified by operation id):                  
       1 - SEL$1                                                                   
       2 - SEL$1 / T1@SEL$1                                                        
       3 - SEL$2 / V@SEL$1                                                         
       4 - SEL$2                                                                   
       5 - SEL$2 / T1@SEL$2                                                        
    Predicate Information (identified by operation id):                            
       1 - access("T1"."C1"="V"."C1")                                              
    Column Projection Information (identified by operation id):                    
       1 - (#keys=1) "T1"."C1"[NUMBER,22], "T1"."C2"[NUMBER,22],                   
           "V"."CNT"[NUMBER,22]                                                    
       2 - "T1"."C1"[NUMBER,22], "T1"."C2"[NUMBER,22]                              
       3 - "V"."C1"[NUMBER,22], "V"."CNT"[NUMBER,22]                               
       4 - (#keys=1) "C1"[NUMBER,22], COUNT(*)[22]                                 
       5 - "C1"[NUMBER,22]                                                         
    Note                                                                           
       - dynamic sampling used for this statement                                  
    40 rows selected.
    Elapsed: 00:00:00.01
    UKJA@ukja102>
    UKJA@ukja102>
    UKJA@ukja102> @end
    UKJA@ukja102> set echo offDion Cho

  • SQL query generating data in SQL management studio but not in CUIC interface

    Hello,
    I'm working on a UCCE 9.0 system
    I created SQL query for a  report.
    Whenever I run the query inside the SQL management studio, it works and generates data, but when I run it in the CUIC interface it works but generates nothing. As you can see in the below snapshot, it contains 209 records that are not being displayed.
    Any help would be greatly apprciated

    Is it a custom report ? Can you right click on your Custom Report and click on Edit Views. You need to check whether you have Grid Headers Listed.
    Regards,
    Senthil

  • SQL Query on Planning Repository

    Hi all,
    Let's say that I have an Entity Hierarchy as follows:
    - Entity
    + E1
    + E2
    + E3
    E31
    E32
    + E4
    E41
    E42
    + E5
    E6
    E7
    + E8
    E31 (Shared)
    and we have access control set at group level:
    - G1 has write access to Idesc(E1)
    - G2 has write access to Idesc(E2)
    - G3 has write access to Idesc(E3)
    - G4 has write access to Idesc(E4)
    - G5 has write access to Idesc(E5)
    - G8 has write access to Idesc(E8)
    I have one user U2 who belongs to G2.
    How could I build a SQL query to determine if U2 has access to Base Entity E31?
    I have taken a look to http://camerons-blog-for-essbase-hackers.blogspot.nl/2011/10/stupid-planning-queries-6-security.html
    although we would have to check if the base entity belongs to any of the entities where U2 has access.
    Thanks for any help.

    I believe it's commonly known that it's case sensitive. e.g. it's documented here:
    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=using_recordsets_7.html
    "Unlike the rest of ColdFusion, Query of Queries is case-sensitive. However, Query of Queries supports two string functions, UPPER() and LOWER(), which you can use to achieve case-insensitive matching."

  • Query That Retrieves New Customers & Leads By Date

    Hello All --
    We would like to create a Query that retrieves new customers and leads based on the date (or date range) they are entered into SAP. 
    Can we create a UDF named STDATE --- Start Date -- and have a Query that allows us to select based on this date range?
    Start dates are entered in this format --- YYYYMMDD.
    Then, the Query would pull out:
    Contact...Company...Bill To Address...Bill To City...Bill To State....Bill To Zip...Phone...Email
    Is this possible to do?
    Thanks!
    Mike

    Hi Mike ,
    You can add some other field as you like .This report will give you combination of both customer and lead .
    I couldn't understand the purpose ,but I like previous query as i have flexibilty to choose customer or vendor .
    SELECT T0.[CreateDate], T0.[CntctPrsn], T0.[CardName], T0.[Address], T0.[City], T0.[E_Mail], T0.[ZipCode], T0.[Phone1] FROM OCRD T0 WHERE T0.[CardType] in ('C','L') and T0.[CreateDate]=[%0]
    If you agree with me ,you can use this query
    SELECT T0.[CreateDate], T0.[CntctPrsn], T0.[CardName], T0.[Address], T0.[City], T0.[E_Mail], T0.[ZipCode], T0.[Phone1] FROM OCRD T0 WHERE T0.[CardType] =[%0] or T0.[Cardtype]=[%1] and
    T0.[CreateDate]=[%2]
    Regarding the date issue , since you are entering paramenter it will match with the date you are looking for .If you have more than one customer created on same day , you willreceive multiple client .
    Thank you
    Bishal

  • Creating reports in BI EE from PL/SQL query

    Please provide me solution of how to create reports in Oracle BI EE tool while using PL/SQL query block.
    Thanks
    Rajni Sharma

    Narender Singh wrote:
    Dear All,
    We are using Oracle APPS, we have two tier structure.I bet it is actually 3-tier & WebServer exists
    1) Application Tier
    2) Database Tier
    My requirement is to run a PL/SQL script to create directory structure in Unix box of Database Tier. I would be very grateful to person proving the input related to the same.
    I want to create directory structure to store different type of files.
    /usr/tmp/2000/jan/file1
    /usr/tmp/2000/jan/file2
    /usr/tmp/2000/jan/file3
    /usr/tmp/2000/jan/file4
    similarly, I have to create directory structure from year 2000- 2011 and for each year I have to 12 folder for months and then for each month I can have n number of file folders.
    We are using 11g database.
    Thanks in Advance!!
    Regards,
    Narender
    Edited by: Narender Singh on Aug 9, 2011 10:50 AMDBMS_SCHEDULER that invokes OS shell script

  • Creating Crystal Reports Dynamically from an incoming SQL query

    Hi,
    I have a requirement where a sql query will be entered by the user in a text box and in the back end java code, i have to create a crystal report dynamically based on that sql query and show it in the crystalviewer object.
    For example if the user writes "select x,y from xtable ", i should be able to create a report with 2 fields, and if the user says "select x,y,z from xtable" then i should be able create and show a report with 3 fileds...thsi report creation should be done in the click event.
    Is this possible in java? I have found something similar in .NET... pls have a look at this 
    http://vb.net-informations.com/crystal-report/dynamic_crystal_report_from_sql_query_string.htm
    Thanks,
    Preethi

    Hi Preethi,
    Can you please share the steps with me? I am also looking for dynamic SQL being applied to the crystal report.
    Thank you so much for your help in advance.
    Regards,
    Janakiram D.

Maybe you are looking for

  • 1935 error PSE 11 on Windows 7 64bit

    Cannot install PSE 11 on new computer. Windows 7 64-bit. I have the license.

  • Interface between Lotus Notes Data Base &  SAP

    Hi All, Our client is having both Lotus Notes Database & SAP. Theirs some data is stored in the Lotus Notes Database. Now they want to transfer that data into SAP. What we have suggested is to download the data from the Lotus Notes into excel sheets

  • My iphone 5 deleted my outlook calendars on my laptop.

    When I synced my iphone 5 and laptop my iphone deleted a couple of outlook calendars off my laptop. Is there a way to find and restore the deleted calendars?

  • Weird characters in g++ output

    When using Arch and ssh/xterm to remotely logging into an Ubuntu machine (university lab computer)  to run g++, the complier output (when there's a compile error) has an accented character "a hat" (i.e. the character "a" with a caret symbol above it)

  • How do I center my slide in the window in keynote

    how do I center my slide in the window in keynote? I know I can fit to window, but can I have the slide smaller than my window and centered? It stays in the upper left hand corner.