Help Needed in Relational logic

Hi
Working in 2008 R2 version.
Below is the sample data to play with.
declare @users table (IDUser int primary key identity(100,1),name varchar(20),CompanyId int, ClientID int);
declare @Cards table (IdCard int primary key identity(1000,1),cardName varchar(50),cardURL varchar(50));
declare @usercards table (IdUserCard int primary key identity(1,1), IDUser int,IdCard int,userCardNumber bigint);
Declare @company table (CompanyID int primary key identity(1,1),name varchar(50),ClientID int);
Declare @client table (ClientID int primary key identity(1,1),name varchar(50));
Declare @company_cards table (IdcompanyCard int primary key identity(1,1),CompanyId int,IdCard int)
Declare @Client_cards table (IdclientCard int primary key identity(1,1),ClientID int,IdCard int)
insert into @users(name,CompanyId,ClientID)
select 'john',1,1 union all
select 'sam',1,1 union all
select 'peter',2,1 union all
select 'james',3,2
Insert into @usercards (IdUser,IdCard,userCardNumber)
select 100,1000,11234556 union all
select 100,1000,11234557 union all
select 100,1001,123222112 union all
select 200,1000,2222222 union all
select 200,1001,2222221 union all
select 200,1001,2222223 union all
select 200,1002,23454323 union all
select 300,1000,23454345 union all
select 300,1003,34543456;
insert into @Cards(cardName,cardURL)
select 'BOA','BOA.com' union all
select 'DCU','DCU.com' union all
select 'Citizen','Citizen.com' union all
select 'Citi','Citi.com' union all
select 'Americal Express','AME.com';
insert into @Client(name)
select 'AMC1' union all
select 'AMC2'
insert into @company(name,ClientId)
select 'Microsoft',1 union all
select 'Facebook',1 union all
select 'Google',2;
insert into @company_cards(CompanyId,IdCard)
select 1,1000 union all
select 1,1001 union all
select 1,1002 union all
select 1,1003 union all
select 2,1000 union all
select 2,1001 union all
select 2,1002;
Requirement : 
1. Get the distict Users card details. the reason for using distinct is, user can have same card multiple with different UserCardNumber.
Ex : user can have more than BOA card in the @usercards table with different UserCardNumber. But though he has two BOA card, my query should take one row.
2. After the 1st step, i need to check if any details on @company_cards based on Users companyId.If yes then selct the details from @company_cards. if not select it from @client_cards
In this case we need to make sure that we shouln't have repeated data on @FinalData table. 
My Logic:
Declare @FinalData table (IDCard int,CardName varchar(50),CardURL varchar(50))
declare @IdUser int = 100, @ClientID int,@companyID int;
select @ClientID = ClientID,@companyID = CompanyId from @users where IDUser = @IdUser;
insert into @FinalData (IDCard,CardName,CardURL)
Select distinct c.IdCard,c.cardName,c.cardURL from @usercards UC join @Cards C on(uc.IdCard = c.IdCard)
where IDUser=@IdUser;
if exists(select 1 from @company_cards where @companyID = @companyID)
BEGIN
insert into @FinalData(IDCard,CardName,CardURL)
select c.IdCard,c.cardName,c.cardURL from @company_cards cc join @Cards c on(cc.IdCard = c.IdCard) where CompanyId = @companyID
and cc.IdCard not in(select IDCard from @FinalData);
END
ELSE
BEGIN
insert into @FinalData(IDCard,CardName,CardURL)
select c.IdCard,c.cardName,c.cardURL from @client_cards cc join @Cards c on(cc.IdCard = c.IdCard) where ClientID = @ClientID
and cc.IdCard not in(select IDCard from @FinalData);
END
select * from @FinalData;
the logic produces the valid result. Is there any alternative way to achieve this logic. I feel there might be some proper way to query this kind of logic. any suggestion please.
[the sample schema and data i provided just to test. i didn't include the index and etc.]
loving dotnet

You can simply merge the statements like below
Declare @FinalData table (IDCard int,CardName varchar(50),CardURL varchar(50))
declare @IdUser int = 100
;With CTE
AS
Select IdCard, cardName, cardURL,
ROW_NUMBER() OVER (PARTITION BY IdCard ORDER BY Ord) AS Seq
FROM
Select c.IdCard,c.cardName,c.cardURL,1 AS Ord
from @usercards UC join @Cards C on(uc.IdCard = c.IdCard)
where IDUser=@IdUser
union all
select c.IdCard,c.cardName,c.cardURL,2
from @company_cards cc join @Cards c on(cc.IdCard = c.IdCard)
join @users u on u.CompanyId = cc.CompanyId
where u.IDUser = @IdUser
union all
select c.IdCard,c.cardName,c.cardURL,3
from @client_cards cc join @Cards c on(cc.IdCard = c.IdCard)
join @users u on u.ClientID= cc.ClientID
where u.IDUser = @IdUser
)t
insert into @FinalData (IDCard,CardName,CardURL)
SELECT IdCard, cardName, cardURL
FROM CTE
WHERE Seq = 1
select * from @FinalData;
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • Help needed on the logic used to display ERP Sales order in CRM WEB UI

    Hi,
    I have a requirement where i need to trigger an activity/workflow in CRM for orders that are created through ERP Salesorder functionality. In the workflow list, we need to give the order description and provide an hyperlink to the order number. on selection of order number, it should display the ERP sales order. To achive this in workflow, i am trying to understand the as-is standard functionality which is available in Agent Inbox search on ERP sales order.This search is getting the ERP orders and on selecting the order it is opening the ERO sales order page. I tried debugging the method GET_MAINCATAEGORY available in the component iccmp_inbox and in the view Inboxsearch.But couldnt really able to crack the logic how it is retrieving the ERP sales order from inbox search. Any pointers on how this is achieved will be of great help.
    Thanks,
    Udaya

    Hi Denis,
    very good idea. I thougt myself about that workaround, but it is not really that for what I searched.
    I mean the "SAP Query" is a really good standard tool, that are used by many customers. That is why think there must be a standard way to display the SAP Query in the Web UI without using Transaction Launcher.
    But it seems that there is no way, except of the transaction launcher or by using an additional analyse system like SAP BI.
    By the way do you know a Web UI compoment which enable the user to start reports like SE38?
    Regards
    Fabian

  • Help Needed in Date Logic

    Hi I am working in sqlserver 2008 R2 and below is my sample research query
    i am trying to get previous 6 months data.
    WITH CutomMonths
    AS (
    SELECT UPPER(convert(VARCHAR(3), datename(month, DATEADD(MM, DATEDIFF(MM, 0, GETDATE()) - N, 0)))) Month
    ,DATEADD(MM, DATEDIFF(MM, 0, GETDATE()) - N, 0) startdate
    ,DATEADD(MM, DATEDIFF(MM, 0, GETDATE()) - N + 1, 0) enddate
    FROM (
    VALUES (1)
    ,(2)
    ,(3)
    ,(4)
    ,(5)
    ,(6)
    ) x(N)
    WHERE N <= 6
    SELECT month
    ,SUM(isnull(perks.amount,0)) AS PerkAmount
    FROM CutomMonths
    LEFT JOIN (
    select 10.00 as amount,'2014-04-03' as StartDate,'2015-04-03' as EndDate union all
    select 10.00 as amount,'2014-04-03' as StartDate,'2015-04-03' as EndDate
    ) perks ON
    CutomMonths.startdate >= perks.StartDate
    AND CutomMonths.startdate < perks.EndDate
    GROUP BY CutomMonths.Month
    ,CutomMonths.startdate
    ORDER BY CutomMonths.startdate ASC
    current output what i am getting:
    Expected Output:
    I found why the April month i din't get the $20 because the startdate of my perks CTE '2014-04-03'. If it is '2014-04-01' then i will get the expected output.
    But i should not change the the date on perks. How to neglect this date issue and consider the month instead to get the expected output. please help me on this as i am struggling on my logic 
    loving dotnet

    I'm just going to focus on the JOIN criteria in this reply since my answer above and your 2nd response are essentially the same except for the JOIN.
    What your are describing and what you are doing in code is conflicting. 
    You are saying this:
    "I just need to check whether the perks start date falls in between month start date and month end date"
    ..., which translated directly to code would be this:
     ON perks.StartDate >= CustomMonths.StartDate
    AND perks.StartDate <= CustomMonths.EndDate
    What I believe you are getting after is this:
    "I just need to check whether the dates within the perks start and end date range fall in between month start date and month end date"
    ..., which translated directly to code would be this, which is also my answer proposed above:
    ON CustomMonths.StartDate >= DATEADD(DAY, -(DAY(perks.StartDate) - 1), perks.StartDate)
    AND CustomMonths.StartDate <= perks.EndDate
    However, if you really want to use the code solution you proposed, then you would actually be saying this:
    "I just need to check whether the dates within the perks start and end date range fall in between month start date and month end date, but if perk end date happens to be the first day of the month, then ignore it and use the previous day."
    ..., in which case then your code, as follows, would be the solution:
     ON CutomMonths.startdate >= DATEADD(mm, DATEDIFF(mm, 0, perks.StartDate), 0)AND CutomMonths.startdate < DATE
    ADD(mm, DATEDIFF(mm, 0, perks.EndDate), 0)
    NOTE: The alternate JOIN I had commented out in my proposed answer above will do the exact same thing as your latest proposed solution
     ON CustomMonths.StartDate >= DATEADD(DAY, -(DAY(perks.StartDate) - 1), perks.StartDate)
    AND CustomMonths.StartDate < perks.EndDate
    BTW, I see how you are getting to the first day of the month by subtracting all the months from the given date to 01/01/1901, and then turning around and adding them all back to 01/01/1901.  While that is one way to get to the first day of the month, it
    seems excessive from a calculation stand point, although I haven't performed any performance tests to know for certain.
    SELECT DATEADD(mm, DATEDIFF(mm, 0, '2014-04-03'), 0)
    I prefer simply subtracting one less than the current day number from the given date to get to the same first day of the month value.
    SELECT DATEADD(DAY, -(DAY('2014-04-03') - 1), '2014-04-03')

  • Help needed in business logic implmentation in oracle sql.

    I got a requirement from customer that i need to generated numbers based on first value which is entered by users but not second values..
    for example:
    c1 c2
    1 1
    2 1
    3 1
    4 1
    1 2
    2 2
    3 2
    4 2
    1 3
    2 3
    3 3
    4 3
    1 4
    2 4
    3 4
    4 4
    1 5
    2 5
    3 5
    4 5
    unlimited..
    the user input only first column values which comes from UI and i need to provide second column values when records are getting inserted into db table.
    user always enter only 1-4 values in first column but never input second values in second column of table.. both columns are numerical.
    the second values should be provided automatically or programmatically when records are getting inserted into table and automatically... how this can be done?
    Can any one help me out to get this done either using sql,plsql concept?
    thanks a lot in advance.

    Hi,
    Demonstration
    SQL> DROP TABLE t1;
    Table supprimée.
    SQL> CREATE TABLE t1 (c1 NUMBER, c2 NUMBER);
    Table créée.
    SQL>
    SQL> insert into t1 (c1) values(1);
    1 ligne créée.
    SQL> insert into t1  (c1) values(2);
    1 ligne créée.
    SQL> insert into t1 (c1) values(3);
    1 ligne créée.
    SQL> insert into t1 (c1) values(4);
    1 ligne créée.
    SQL> insert into t1 (c1) values(1);
    1 ligne créée.
    SQL> insert into t1 (c1) values(2);
    1 ligne créée.
    SQL> insert into t1 (c1) values(3);
    1 ligne créée.
    SQL> insert into t1 (c1) values(4);
    1 ligne créée.
    SQL> insert into t1 (c1) values(1);
    1 ligne créée.
    SQL> insert into t1 (c1) values(2);
    1 ligne créée.
    SQL> commit;
    Validation effectuée.
    SQL>
    SQL> CREATE OR REPLACE VIEW view_t1
      2  AS
      3     SELECT c1, ROW_NUMBER () OVER (PARTITION BY c1 ORDER BY c1) c2
      4       FROM t1;
    Vue créée.
    SQL>
    SQL>
    SQL> SELECT   c1,c2
      2      FROM view_t1
      3  ORDER BY c2, c1;
            C1         C2
             1          1
             2          1
             3          1
             4          1
             1          2
             2          2
             3          2
             4          2
             1          3
             2          3
    10 ligne(s) sélectionnée(s).
    SQL>

  • Help needed in Count Logic

    Hi Following are my table structure and data . i have two column( No.of.Fields , Text)
    No.of.Fields | Text
    8 | YYYYYYYY
    6 | YYYYYY
    4 | NNNN
    3 | NNN
    2 | YYYYY
    i want a sample query to validate the no.field count and Text char count matches. if that doesn't match i want to get the particular record details.
    In the above sameple no.of field 2 has exceeds char count. actual text shoulod be "YY".
    so please help me to identify the rows which has non matached. i have more than 500 records in the table. please help me on this by providing the sample.

    Hi.
    >
    Don't forget about NULLs:
    >
    Thanks you're right, it depends on how he want to deal with nulls, e.g. if we assume that nulls have a length of 0
    Here's one way:
    WITH data AS
         SELECT 8 n,'YYYYYYYY' string FROM DUAL UNION ALL
         SELECT 6 n,'YYYYYY' string FROM DUAL UNION ALL
         SELECT 4 n,'NNNN' string FROM DUAL UNION ALL
         SELECT 3 n,'NNN' string FROM DUAL UNION ALL
         SELECT 2 n,'YYYYY' string FROM DUAL UNION ALL
         SELECT 8 n,'YYYYYYY' string FROM DUAL UNION ALL
         SELECT 6 n,'YYYYY' string FROM DUAL UNION ALL
         SELECT 4 n,'NNN' string FROM DUAL UNION ALL
         SELECT 3 n,'NN' string FROM DUAL UNION ALL
         SELECT 2 n,'YYYY' string FROM DUAL UNION ALL
         SELECT 0 n,null string FROM DUAL UNION ALL
         SELECT 1 n,null string FROM DUAL
    SELECT
         n,
         string,
         NVL(LENGTH(string),0) ls
    FROM data
    WHERE n != NVL(LENGTH(string),0);
    N     STRING     LS
    2     YYYYY     5
    8     YYYYYYY     7
    6     YYYYY     5
    4     NNN     3
    3     NN     2
    2     YYYY     4
    1     (null)     0Best regards.

  • Help needed on Mapping logic

    Hi guys,
    I have logic like,
    pernr>logic>pernr.
    Pernr is the first field.
    Whenever the logic fails, it should not process rest of the below fields.
    it should directly go to next record.
    Any ideas.......
    santosh.

    You can achieve this using gloval variable.
    1. right click on the parent node  of pernr. -
    >Add Variable (say ifPernrTrue)
    2. Map this variable with the same logic and give value "true" if logic successful and "false" if logic fails
    Whenever the logic fails, it should not process rest of the below fields.
    3.Map rest of fields as :
    ifPernrTrue (the variable u created) \
    >   if  (without else )  -
    > fields...
                   source filed     /

  • Help needed urgently related to tomcat

    hi all ,
    When i start my tomcat i get an error message cannot find file '-Xsm512m' (or one of its components). Make sure the path and filename are correct and that all required libraries are available
    I cannot make anything out of this message
    Please someone tell me hoe to tackle this error i need it urgently
    thanking in advance
    waiting in anticipation of replies

    no
    noone has done it explicitly
    actually ny tomcat was runing fine
    but i started getting this error after my PC in office was configured with my ID
    can u suggest what must be wrong with catlina.bat?
    anyways that i can rectify it?

  • Help needed in the logic

    i hav select query like this:-
    SELECT COUNT(*) INTO NO_OF_WORKERS FROM PA0000
    WHERE ENDDA = '99991231' AND STAT2 = '3'.
    with this select query , i can get the no. of workers .
    How can i get the no. of workers in the recording period <u><b>excluding</b></u> those persons who were absent from work on paid/unpaid leave for the entire period?

    Hi Hari,
    I got the solution for you.use the following sql query.
    SELECT COUNT(*) INTO NO_OF_WORKERS
    FROM PA0000 AS a inner join PA2001 as b on apernr = bpernr
    WHERE aENDDA = '99991231' AND aSTAT2 = '3'
    and ( bawart = '0100' or bawart = '0727' ).
    Now onething, in my comapany, in PA2001, field awart = '0100' means paid leave and 0727 means unpaid leave.
    this things r configured in SPRO. so must replace the values of awart in sql qurey as per the values of paid/unpaid leave in your company.
    you can do one thing, go to infotype pa30..then put 2001 in the infotype field in that screen, put cursor in STy field , hit F4 , it will show you the value for paid unpaid leave.
    Note the value , modify the value of awart field inthe sql query, thats it.
    cheers, and hey dont forget to give reward points.

  • Help needed Regarding a business logic

    Hi all,
    My business requirement is
    requires to get a checksum from the KIOSK field. This would be something like a rule that for a given KIOSK generates a number from 0 to 9.
    The Field value contains alphanumerical
    Can any of guys help me in this logic.how to generate a checksum for a given field..
    Thanks & Regards;
    Vinit

    Alright I found something  I am not  sure if it is of use to you , A checksum is generally used to  detect the integrity of file
    it is calculated oin basis of hash algorithms so  how it is useful to for incoming filed values i m not  sure
    Please find the links below
    http://en.wikipedia.org/wiki/Checksum
    http://www.fastsum.com/support/online-help/checksums.php
    http://www.flounder.com/checksum.htm
    http://www.mkyong.com/java/how-to-generate-a-file-checksum-value-in-java/
    If it is useful , you need to implement a hash algorithm
    regards
    Ninad

  • Want to use Logic 8 Pro for Podcasting, help needed

    I have a few problems. I just switched over to Logic after using ProTools for 4 years so I'm a newbie. I'm about to start a podcast soon and I want to use Logic 8 Pro to do so. Is there a book that someone can recommend me for getting familiar with Logic?
    Here are the things I need to get done:
    I have a mixer and I need to know how to record the sounds playing through my computer to end up in Logic. I basically want to be able to capture the audio playing on my computer and have that be on the podcast. How do I do this?
    Secondly, I'm confused about what Input 1 and Input 2 are. What is the difference?
    I'd appreciate anyone who could IM me to help me further with Logic if I have a quick question or anything. My AIM screen name is DirtyVibes. Any help would be appreciated.
    Thank you,
    -RandomSkater

    Is there a book that someone can recommend me for getting familiar with Logic?
    Yes, the Getting Started manual, you can download it from Apple.
    I have a mixer and I need to know how to record the sounds playing through my
    computer to end up in Logic. I basically want to be able to capture the audio
    playing on my computer and have that be on the podcast. How do I do this?
    I'm not sure what you are asking here. If you want to record the whole output of your computer, I recommend using a virtual audio driver like Soundflower or Jack.
    Secondly, I'm confused about what Input 1 and Input 2 are. What is the difference?
    Input 1 is the input marked "1" on your audio interface (or the left channel on a stereo pair).
    Input 2 is the input marked "2".
    If your audio interface has more than 2 inputs, they will all show up, so you can record different inputs to different tracks if required.
    You might be better off using Garageband to record your podcasts, it's simpler and has dedicated podcast functions (like adding iTunes artwork and so on).

  • Help needed setting up Related Content in HCM 9.1 PeopleTools 8.51

    I need some help setting up Related Content in HCM 9.1 PeopleTools 8.51.
    I created a new service id in "Define Related Content Service". Its simple, it basically goes to google.com.
    Then I assigned Related Content to Application Pages on the "Manage Related Content Configuration" page. I'm my scenario I added it to Careers right under the root menu.
    Then I went to the careers page, but the "related information" link doesn't appear. How do I get that related information link to appears in the top of the component/page?
    Thanks,
    -Cory

    In order to get this to function, there are some baseline server configuration requirements that you need in order for it to work.
    1) Define the authentication Domain on the webserver
    2) Define the authentication Domain on the web profile
    3) Enable Single Sign-On
    The following document in 'My Oracle Support' will provide you with the details on configuration related content services.
    E-PORTAL: How To Configure Related Content Service. [ID 984855.1]
    In addition here is a link to the online PeopleBooks that discusses the configuration of the related content services.
    http://download.oracle.com/docs/cd/E18083_01/pt851pbr0/eng/psbooks/tprt/book.htm?File=tprt/htm/tprt20.htm#H3002
    In addition, there are also some know limitations on the use of related content that are different dependent on the tools version you are using.
    Hope this helps.

  • HT1338 Macbook pro two days old...bought logic from app store...logic has installed partly each time i open it up it wants to download rest of programme then stops half way thru and gets error message 'logic is unable to continue with download' help neede

    Macbook pro two days old...bought logic from app store...logic has installed partly each time i open it up it wants to download rest of programme then stops half way thru and gets error message 'logic is unable to continue with download' help needed !

    Hello:
    I would trot back into the Apple store and have them fix the problem (or call Applecare with a warranty issue).  There is no sense in you wasting your time trying to troubleshoot things on a new computer.
    Barry

  • Help need in writing a logic/proc

    SELECT   TRACK_NUM, MIN(sub_account) AS START_KEY, MAX(sub_account) AS END_KEY
      FROM (
                  SELECT to_number(sub_account) as sub_account,
                  RANK() OVER (PARTITION BY sub_account
                  ORDER BY ROWNUM) AS ROW_INSTANCE,
                  NTILE(  20  ) OVER (ORDER BY sub_account) AS TRACK_NUM
                  FROM  STG_SUB_MASTER_MONTH_HISTORY)
                  WHERE ROW_INSTANCE = 1
                  GROUP BY TRACK_NUM ;The above sql gives result set like
    TRACK_NUM     START_KEY     END_KEY
    1     200000028     2095931954
    2     2095932501     5067004214
    3     5067004346     1.1092E+10
    4     1.1092E+10     2.1028E+10
    5     2.1028E+10     2.3078E+10
    6     2.3078E+10     2.9010E+10
    7     2.9010E+10     3.1089E+10
    8     3.1089E+10     3.3051E+10
    9     3.3051E+10     3.4081E+10
    10     3.4081E+10     3.7014E+10
    11     3.7014E+10     3.7067E+10
    12     3.7067E+10     4.1006E+10
    13     4.1006E+10     4.5040E+10
    14     4.5040E+10     4.9047E+10
    15     4.9047E+10     5.2030E+10
    16     5.2030E+10     6.4578E+10
    17     6.4578E+10     7.1001E+10
    18     7.1001E+10     7.1035E+10
    19     7.1035E+10     7.2048E+10
    20     7.2048E+10     7.9553E+10Now i have to pass these start key and end key to my below code
    Insert into /*+ Parallel (A,8) append */ Sub_phone_Rateplan_fss A
    SELECT /* Index(Sub, IDX_Sub_hist)*/
                    sub.MARKET_CODE        ,
                            sub.SUB_CTYPE ,
                            phn.PH_BASIC_SRV        ,
                            sub.MONTH_ID  ,
                             sub.SUB_ACCOUNT        ,
                            sub.SUB_LAST_NAME     ,
                           sub.SUB_FIRST_NAME   ,
                            SUB.WS_ENTRY_DATE AS SUB_WS_ENTRY_DATE   ,
                            sub.WS_DISC_DATE       ,
                            sub.SUB_DISC_REASON ,
                            sub.SUB_BILL_CYCLE    ,
                            sub.SUB_MUN_CODE     ,
                            sub.SUB_30DAY_BAL     ,
                            sub.SUB_60DAY_BAL     ,
                            sub.SUB_90DAY_BAL     ,
                            sub.SUB_OVR90_BAL     ,
                            sub.SUB_WRTOFF_AMT ,
                            sub.SUB_BALANCE_DUE ,
                            sub.SUB_CURRENT_BAL ,
                            sub.SUB_STATUS,
                            phn.PH_MOBIL_ID         ,
                            phn.WS_ESN_UN           ,
                            phn.WS_START_DATE    ,
                            phn.WS_STOP_DATE      ,
                            PHN.WS_ENTRY_DATE AS PHN_WS_ENTRY_DATE   ,
                            phn.PH_STATUS            ,
                            phn.PH_FEAT_CODES     ,
                            phn.PH_MODEL  ,
                            phn.CRICKET_LOCATION_ID_KEY           ,
                            phn.FEATURE_SET_ID 
                         -- NTILE(10) OVER(PARTITION BY SUB.SUB_ACCOUNT ORDER BY SUB.SUB_ACCOUNT) AS NT
                        FROM STG_SUB_MASTER_MONTH_HISTORY SUB, STG_PHN_MASTER_MONTH_HISTORY PHN
                        WHERE
                        --SUB.MONTH_ID = PHN.MONTH_ID
                         SUB.SUB_ACCOUNT = PHN.PH_ACCOUNT 
                         And to_number(SUB.Sub_Account)  BETWEEN   @startkey and  @endkey;
                                          Commit;can anyone help me getting the logic or the procedure since i have to use the result set provided above by the first query.
    Message was edited by:
    Vakeel

    Hi, Vakeel,
    The usual way of using the results of one query in another is to join the two queries. Sometimes it's easier to do a corellated sub-query instead. I can't tell which is the best way for you, or exactly how to do it, because I don't understand exactly what results you want.
    Please post a few rows of sample data and the results you want to get from that data. Simplify as much as possible. For example, post a query that uses NTILE (4) instead if NTILE (20). (If you know how to solve one, you can solve the other.)
    Another example: only select a couple of columns in the second query.

  • T400 - Accidentaly formatted the disk 1 (IMD-0) partition in disk management - Help Needed

    Hello,
    Initially when I re-formatted my computer to get rid of the factory image, I found that there was a hidden partition of 1.37GB which I could not touch, meaning i could not delete. I ignored it at that time and formatted my computer and reinstalled vista business on it using the license i got from lenovo. Now after some days, I was kind of getting concerned as to what exactly was the 1.37Gb partition on my computer. I guess I was getting worried as to why I was not able to reclaim that space for normal use. Today, I tried to reclaim it, by deleting the volume, thinking it should merge into the unallocated space, that I have on my primary hard drive. But it did not. However, what happened was that this space of 1.37GB did start showing up on My Computer, once I formatted it using NTFS. I then checked its properties in My Computer and it had an option of readyboost. I selected the option which says use this disk for readyboost, and immediately in no time, the disk was full with on 68MB remaining as free space. It also has an icon of readyboost in the drive, when I double-click it. This is when I figured that this space could be on a separate physical disk. I did some research and found out that this drive or device or chip, is listed as Disk-1 in disk management and as IMD-0 under Disk Drives in Device Manager. I googled about it, and found that it was related to the turbo memory. Now, I believe that turbo memory would be a separate flash chip, which would be hardwired to function in a particular way (enabling boosting speeds), and that it would be non-accessible to users from within windows for formatting or doing anything else. Hence, I also believe that the space which I reclaimed, is existing on my primary 320GB hard drive and is used in addition to the turbo memory, as a  cache, to boost speeds. However, since I do not understand the turbo memory concept very well, I would really appreciate if someone could explain how the turbo memory works, i.e. including IMD-0 and all that. And the main help I need is on how to hide the 1.37GB partition again, and put it in a format that it was earlier in, and usable for turbo memory. At present I do not know if it is being used by turbo memory or not, but below is the current status of the turbo memory:
    1. In Device manager, under disk drives, IMD-0 shows up, and in properties it just says device type -- disk drive. Now I read somewhere that it should say NVCACHE, but it does not say that on my pc, under any tabs of the properties of IMD-0. Can someone help me putting it back there.
    2. Under Disk Management, it says Local Disk H:, 1.37GB NTFS, Healthy (Active, Primary Partition). I don't exactly remember, but I guess prior to me formatting it, it said unallocated. Help needed here too.
    3. In the Turbo memory controller, it says Windows readyboot enabled, Windows Readydrive enabled, 2GB
    and below that I have checkboxes for enabling windows readyboost and readydrive checked.
    So guys, can please anyone help me in re-hiding the 1.37GB partition and making it in the state it was before.
    Thanks a lot for your help.

    Hi Eric,
    Please refer the following HP article to expand your array , refer the TechNet article to expand your drive:
    HP Proliant Servers - How to Expand an Array and Extend the Logical Drive
    http://h20566.www2.hp.com/portal/site/hpsc/template.PAGE/public/psi/mostViewedDisplay/?javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken&javax.portlet.prp_efb5c0793523e51970c8fa22b053ce01=wsrp-navigationalState%3DdocId%253Demr_na-c03510253-1%257CdocLocale%253Den_US&javax.portlet.tpst=efb5c0793523e51970c8fa22b053ce01&sp4ts.oid=4231377&ac.admitted=1411638027623.876444892.199480143
    TechNet article:
    Extend System/Boot Volume on Windows Server 2008/ Windows Vista/Win7 Beta
    http://blogs.technet.com/b/mghazai/archive/2009/02/24/extend-system-boot-volume-on-windows-server-2008-windows-vista-win7-beta.aspx
    Extend a simple or spanned volume
    http://technet.microsoft.com/en-us/library/cc776741.aspx
    I’m glad to be of help to you!
    *** This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control
    these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the
    use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. ***
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Solution Design questions/suggestions/help needed

    Hi,
    I would appreciate any inputs regarding this.
    I am thinking of designing Solutions in Solman for our landscape which consists of ECC 6 and PI 7.1; each having a 3 system landscape D-Q-P. Is there an issue if I create Solutions Dev, QA and Prod vs Solutions ECC and PI ? I am more in favor of the former because it allows me easier management of the landscape when I implement System Monitoring, EWA, System Administration to see everything for the critical Prod systems together. Do any of you see any downsides to this approach ? Or any advantages of creating Solution ECC and Solution PI ?
    Also, from what I read from the documentation, I would need to create logical component for each system (ZECCDEV,ZECCQA etc) for the systems to show up in the solution landscape ? This is because in the definition of logical components, there is only one field to add the Dev or QA or Prod systems ? I still have to start working on this, so I could be wrong. Please feel free to correct me.
    Any inputs would be appreciated since I am fairly new to this.
    Thanks,
    Shreya

    Hello,
    I am not really sure what you are asking.
    Systems are usually defined (SID) in SMSY, then they are added to a logical component.
    Logicals need to be in the customer name space, so they are copied from SAP References to a unique name prefixed by a "Z".
    Multiple systems  of  any system type (PRD, DEV, QAS, TEST, SANDBOX...etc) can be added to a logical component.
    One or more logical can then be added to a Solution.
    This is basically how the Solution is built. There are some limitations you need to consider when naming systems.
    For certain functions, like EWA reports they need to have a unique Installation # + SID, and in the case of a long_sid, it would be the Installation # + (1st 3 chars of the)Long_SID.
    So if you want to know if you can have a PI system called DEV, QAS and PRD and  a ECC system called DEV, QAS and PRD, you can. But if you name them ECC_DEV, ECC_QAS, and ECC_PRD, then you will have problems.
    A logical name must be unique. But they show up in the system landscape as soon as they have been defined.
    When the logical is added to the Solution, only system Types of Production are automatically set to "Put in Solution"
    Even though you can see the systems of other types in the logical and in the solution. And any system that is not in status "Put in Solution" will not be visible when you try to use it, as an example create an EWA , you would select the solution and not see any other type but production systems to select. This is because system types that are not production need to be manually set to "Put in Solution". This is done in the solution, in Change/Edit mode, and right clicking on the system you want to put in the solution and selecting that option, then saving.
    From your questions am and not exactly sure what you were getting at, but I do hope this general info helps.
    Regards,
    Paul

Maybe you are looking for

  • Customer Support Portal to report problems is not working

    The Customer Support Portal at: https://www.adobe.com/cfusion/support/index.cfm?event=portal&loc=en_us Is not working. I called into installation help.  The person said he could not help me and I needed to report the problem through the Customer Supp

  • How do I leave editable text and images in a PDF?

    I recently bought a flyer template and it came as an editable PDF.  Here is one of the templates http://www.wendygarratt.com/images/flyer.pdf Every field, both text and graphic object, is fully editable in the free Adobe reader.  I have Acrobat X and

  • Why is my iPod Touch now repeating songs once in the Bose Dock?

    Why is my iPod Touch now repeating songs once in the Bose Dock?  How do I get this to stop?  I have already done a factory restore and then reloaded my music onto this iPod. 

  • Aiport express to stereo wirelessly - possible?

    Hi, can airport express stream music to my wireless stereo (sony BDV E670) wirelessly, with no stereo cable? all the configurations I see use a cable from the aiport express to the stereo. Thanks

  • Restrict formula by characteristic

    Hi forum, For an accounts receivable report I need to show two KFs by customer: 1. Balance on a key date 2. days overdue (i.e. how many days the customer is late). This CKF should only be shown for document type = DR (invoice). KF 2 I get through for