WAAS HHD query

Hi Cisco, 
i wanted to know if hard drives are same for below WAAS models and are inter-changeable between them.
WAE-612-K9  --> WAVE-694-K9
WAE-7371-K9 --> WAVE-8541-K9
Note : I need a Cisco TAC engineer specialized in WAAS helping me answering the query. 

WCCP not supported on tunnel interfaces for 6500 & 7600 interfaces. Other than that okay.
see below.
Cisco WAAS supports asymmetric routing through the use of sharing network interception and redirection configuration across WAN boundary routers within a location. If all routers that connect a location to the WAN are participating in the same WCCPv2 service groups or have the same list of WAEs configured as next-hop routers (in the same order), the same WAE will receive redirected traffic regardless of the WAN link that traffic was destined to or coming in from.
For instance, if a customer has two WAN connections - one going to provider #1 and another going to provider #2, WCCPv2 can be configured such that the routers participate in the same WCCPv2 service groups, and the WAEs can be configured to register with both of the routers. This also requires that the WCCPv2 redirection configuration be applied identically across each of the routers within the same location, i.e. use of 61/in on the LAN side on both routers and 62/out on the LAN side on both routers (or any valid combination of 61/62 in/out as long as they are identical amongst all routers within the location).
As traffic enters a WAN boundary router, it will determine which WAE to redirect the traffic to based on a hash of either the source IP (service group 61 in the network path) or destination IP (service group 62 in the network path). The allocated hash buckets are synchronized within the service group, and the hash value obtained at either router will be the same as it would be had the traffic been forwarded through the opposite router. In this way, traffic is always redirected to the same WAE every time, regardless of which WAN link is used, or which router the traffic was forwarded to or through. As such, Cisco WAAS provides support for environments where asymmetric routing may be encountered.

Similar Messages

  • Sloq sql query over waas

    Currently are using a full desktop client for query over line with latency of 60ms. waas shows 86 percent compression/opt but app runs from 3 ms local to 4 minutes over wan. Is there any special setip for ms-sql on waas ?

    A better view of the sql plus worksheet error(s):
    HERE (((PERSON_ALIAS.ALIAS)='1250813')
    *or
    if i remove the Alias value:
    WHERE (((ORDER_DISPENSE.LAST_REFILL_DT_TM)>Date()-60
    *Message was edited by:
    user515661

  • WAAS Default Group query - New Installation

    Hi All,
    This may be a very quick and easy to answer question so here goes.....
    I have a WAAS estate of "X" amount of devices from day one initially the default application acceleration options were fine so all devices as default out of the box join the "AllDevicesGroup". This for the main is absolutely fine.
    I have recently been asked to look at an application for acceleration and am in the process of creating the policy etc to apply, creating new classifiers etc for this.
    My question mainly relates to why i can not see any applications defined when i navigate via:-
    My WAN/Device Group/AllDeviceGroup then Configure/Acceleration/Policy Definitions on the Central Manager
    HOWEVER
    when i navigate directly on to a particular WAE device and go through the same steps above i see a list of applications as you would expect and it then states "inherited from AllDevicesGroup" so i know this is gathering the information regarding config/classifiers etc from the CM AllDevicesGroup.
    i just wonder in this scenario how would i edit an existing default classifier for example wanting to add TCP pport 8082 to HTTP as an example would this mean changing it on every endpoint which to me defeats the object in having a alldevicesgroup?
    any thoughts on this would be appreciated as usual.
    thanks
    craig

    Hello Craig,
    What you are seeing is correct, at least it was also on our lab device.
    You can click on "Restore Predefined Policies and Classifiers" on the My WAN -> Device Group -> AllDeviceGroup -> Configure -> Acceleration -> Policy Definitions page.
    This will populate the page with the default rules, you can then add your custom application to this.
    I hope this helps, Peter

  • Cisco WAAS MIB for CPU AND MEMORY

    Hi,
    I am looking to query Cisco WAAS WAVE and SRE device for basic stuff cpu, memory, interface.
    I managed to get the CPU stats via SNMP using HOST-RESOURCES-MIB, however i cannot use the memory usage utilisation.
    Can you please help.
    Furthermore, I wanted to have some environmental values, temperature. Is there any MIB for that purpose.
    Thanks

    There's a "Show cpu " commmand availabe. Type help or '?' for a list of available commands.

  • WAAS 4.41 upgrade & WCCP

    Hi,
    Since upgrdae a 512 WAAS to 4.4.1 which connects to a 3750, WCCP will not associate.
    A debug on the 3750 "deb ip wccp eve" gives the following :
    Aug  8 15:16:35: WCCP-EVNT:D61: Here_I_Am packet from 172.18.4.241 w/bad rcv_id 00000000
    Aug  8 15:16:36: WCCP-EVNT:D62: Here_I_Am packet from 172.18.4.241 w/bad rcv_id 00000000
    comming from the waas
    2011 Aug  8 14:36:10 UKHSL-WAAS02 wccp: %WAAS-UNKNOWN-7-899999: Query removal message from 172.18.4.242
    2011 Aug  8 14:36:10 UKHSL-WAAS02 wccp: %WAAS-UNKNOWN-7-899999: wccp2.c:8176:
    2011 Aug  8 14:36:10 UKHSL-WAAS02 wccp: %WAAS-UNKNOWN-7-899999: Removal Query from rtr 172.18.1.1 which is not configured for service 61.
    2011 Aug  8 14:36:27 UKHSL-WAAS02 wccp: %WAAS-UNKNOWN-7-899999: wccp2.c:8156:
    2011 Aug  8 14:36:27 UKHSL-WAAS02 wccp: %WAAS-UNKNOWN-7-899999: Query removal message from 172.18.4.242
    2011 Aug  8 14:36:27 UKHSL-WAAS02 wccp: %WAAS-UNKNOWN-7-899999: wccp2.c:8176:
    2011 Aug  8 14:36:27 UKHSL-WAAS02 wccp: %WAAS-UNKNOWN-7-899999: Removal Query from rtr 172.18.1.1 which is not configured for service 62.
    2011 Aug  8 14:36:40 UKHSL-WAAS02 wccp: %WAAS-UNKNOWN-7-899999: wccp2.c:8156:
    2011 Aug  8 14:36:40 UKHSL-WAAS02 wccp: %WAAS-UNKNOWN-7-899999: Query removal message from 172.18.4.242
    2011 Aug  8 14:36:40 UKHSL-WAAS02 wccp: %WAAS-UNKNOWN-7-899999: wccp2.c:8176:
    2011 Aug  8 14:36:40 UKHSL-WAAS02 wccp: %WAAS-UNKNOWN-7-899999: Removal Query from rtr 172.18.1.1 which is not configured for service 61.
    where as the switch is send
    HSL-S-001#
    Aug  8 15:37:38: WCCP-PKT:D62: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B16
    Aug  8 15:37:39: WCCP-PKT:D61: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B1E
    HSL-S-001#
    Aug  8 15:37:40: WCCP-PKT:D62: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B17
    HSL-S-001#
    Aug  8 15:37:41: WCCP-PKT:D61: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B1F
    Aug  8 15:37:42: WCCP-PKT:D62: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B18
    HSL-S-001#
    Aug  8 15:37:43: WCCP-PKT:D61: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B20
    Aug  8 15:37:44: WCCP-PKT:D62: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B19
    Aug  8 15:37:44: WCCP-PKT:D61: Sending Removal_Query packet to 172.18.4.241w/ rcv_id 00018B21
    HSL-S-001#
    Aug  8 15:37:45: WCCP-PKT:D61: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B22
    Aug  8 15:37:46: WCCP-PKT:D62: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B1A
    HSL-S-001#
    Aug  8 15:37:47: WCCP-PKT:D61: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B23
    HSL-S-001#
    Aug  8 15:37:48: WCCP-PKT:D62: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B1B
    Aug  8 15:37:49: WCCP-PKT:D61: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B24
    HSL-S-001#u all
    All possible debugging has been turned off
    HSL-S-001#
    Aug  8 15:37:50: WCCP-PKT:D62: Sending I_See_You packet to 172.18.4.241 w/ rcv_id 00018B1C
    WCCP Status switch
    HSL-S-001#sh ip wccp 61
    Global WCCP information:
        Router information:
            Router Identifier:                   172.18.1.1
            Protocol Version:                    2.0
        Service Identifier: 61
            Number of Service Group Clients:     0
            Number of Service Group Routers:     0
            Total Packets s/w Redirected:        0
              Process:                           0
              CEF:                               0
            Redirect access-list:                WAAS-IP
            Total Packets Denied Redirect:       0
            Total Packets Unassigned:            0
            Group access-list:                   -none-
            Total Messages Denied to Group:      0
            Total Authentication failures:       0
            Total Bypassed Packets Received:     0
    WCCP Status WAAS
    KHSL-WAAS02#sh wccp routers
    Router Information for Service: TCP Promiscuous 61
            Routers Seeing this Wide Area Engine(0)
                    -NONE-
            Routers not Seeing this Wide Area Engine
                    172.18.1.1
            Routers Notified of from other WAE's
                    -NONE-
            Multicast Addresses Configured
                    -NONE-
    Router Information for Service: TCP Promiscuous 62
            Routers Seeing this Wide Area Engine(0)
                    -NONE-
            Routers not Seeing this Wide Area Engine
                    172.18.1.1
            Routers Notified of from other WAE's
                    -NONE-
            Multicast Addresses Configured
                    -NONE-
    Any ideas
    Thanks

    Ian,
    Can you provide the show run output from both the WAE and the 3750?
    Also give the output of show sdm prefer and show version from the 3750.
    Have you tried bouncing WCCP (on the WAE no wccp ver 2, wccp ver 2)?
    Note when doing wccp with WAE and 3750 these are the requirements/ restrictions:
    1) WAE must be Layer 2 adjacent and configured for l2-redirect and mask-assignment
    wccp tcp-promiscuous router-list-num 8 l2-redirect mask-assign
    2) The 3750 must be running a routing SDM template (e.g. desktop-routing)
    3750-Stack#sh sdm prefer
    The current template is "desktop routing" template.
    The selected template optimizes the resources in  the switch to support
    this level of features for
    8 routed interfaces and 1024 VLANs.
      number of unicast mac addresses:                  3K
      number of IPv4 IGMP groups + multicast routes:    1K
      number of IPv4 unicast routes:                    11K
        number of directly-connected IPv4 hosts:        3K
        number of indirect IPv4 routes:                 8K
      number of IPv4 policy based routing aces:         0.5K
      number of IPv4/MAC qos aces:                      0.75K
      number of IPv4/MAC security aces:                 1K
    The important entry is:
    "number of IPv4 policy based routing aces:         0.5K"
    3)  You can only use redirect in statements on your L3 interfaces of the 3750.
    4) If you are using a redirect list, the ACL can only have permit statements.
    Regards,
    Mike Korenbaum
    Cisco Data Center PDI Help Desk
    http://www.cisco.com/go/pdihelpdesk

  • Waas and Cat4500

    Hi,
    I have the Cat4500 and I'd like to use WAAS for TCP optimalization. I can use only WCCPv2 for traffic redirection. I don't know which mask I have to set. I wrote that for Cat4500 is only one mask supported.
    I'm sending you the WCCP configurations of WAE and Cat4500 for WCCP. Are these configs right?
    WAE:
    wccp router-list 1 10.4.238.249
    wccp tcp-promiscuous router-list-num 1 l2-redirect mask-assign l2-return
    wccp version 2
    Cat4500:
    ip wccp ver 2
    ip wccp 61
    ip wccp 62
    int vlan 1
    desc „LAN network“
    ip wccp 61 redirect in
    int vlan 2
    desc „WAN network“
    ip wccp 62 redirect in
    redirect exclude in - is not supported on Cat4500.
    Thank you.
    Roman

    L2 redirection will redirect packets us Layer 2 MAC rewrite vs. Layer 3 GRE.
    As sessions are redirected to the WAE, the original sessions source will be that of switch interface. Upon return the it will be converted back to original source MAC.
    WCCPv2 TECHNICAL DETAILS
    WCCPv2 group membership is initiated by a WAE when it transmits a WCCP2_HERE_I_AM message to each defined network device (or multicast address) in the configured router-list. This message includes details about the WAE, including IP address and service groups that the device wishes to participate in. Upon receipt of the WCCP2_HERE_I_AM message, the network device will respond with a WCCP2_I_SEE_YOU if the device meets group membership criteria (as specified by shared-secret MD5 authentication password or access-list). Upon receipt of the WCCP2_I_SEE_YOU message from the network device, the WAE must respond with another WCCP2_HERE_I_AM message with the "Receive ID" field matching that of the network device message. At this point, the WAE becomes active within the service group and usable, and the network device can begin redirecting traffic to it based on service group assignment. WCCP2_HERE_I_AM and WCCP2_I_SEE_YOU messages continue to be sent every 10 seconds as a service heartbeat. The WAE is directly queried for responsiveness after two missed heartbeats and removed from the service group if a third is missed.
    WCCPv2 is designed to forward traffic to an available WAE using either layer 2 redirection or GRE tunneling (default). One of the components of the WCCP2_I_SEE_YOU message is the advertisement of supported forwarding mechanisms. If a method is not listed, it GRE tunneling is used by default. Redirection assignment is done per service group. A WAE and a network device can use different redirection mechanisms for different services. Layer 2 redirection specifies that the redirecting router will rewrite the Ethernet addresses in the Ethernet header and forward the frames to the WAE. With Layer 2 redirection, the WAE must be adjacent to the network device (attached to the same subnet). GRE tunneling specifies that a GRE tunnel will be established between the network device and the WAE, and the original frames will be encapsulated into this tunnel and delivered to the cache. With GRE redirection, layer 2 adjacency is not required (the WAE can be attached to a different subnet).
    To preserve connection and data integrity, the WAE will only optimize TCP connections or protocol sessions that were redirected from the beginning of the establishment attempt. If a TCP connection or protocol session was previously established from the client to the server before redirection was enabled, the WAE would recognize this as an existing connection or session and simply return the redirected traffic back to the router without applying optimizations. This is a function of the "packet return" capability of WCCPv2. The WCCPv2 packet return capability is also negotiated per service group, per WAE, at the time of joining a service group. This is also a function of the WCCP2_HERE_I_AM and WCCP2_I_SEE_YOU messaging. In the event that messages are redirected to a cache that didn't service the initiation of the connection or session, the WAE will return the messages back to the router within a GRE tunnel for normal handling.
    WCCPv2 provides load-balancing and high availability through a built-in load-balancing mechanism that distributes load amongst WAEs within a service-group. The most common method of load-balancing with WCCPv2 is enabled by use of hash tables. A hash table is a 256-bucket table that is used to define the distribution of traffic amongst applicable caches. The hash table can be built based on a number of items including source or destination IP address.

  • SRE WAAS Power failure

    Hi,
    Two queries:
    What happens when power fails on the ISRG2 router with WAAS running?   Does the WAAS recovers on its own once the power is back up or it needs manual intervention?
    What happens to WCCP interception  if the SRE module fails , does it use fail to wire and pass through all traffic?
    Currently in design phase, we intend to use WAAS 4.5.1 firmware SRE 710 and 910  on ISR 2911 in this project.
    Thanks
    Suja

    Thanks Dan
    Can we alter the reset interval to the reduce the downtime.
    A failover query this time:
    For a Layer 3 link between Datacentre's what would be the best option ?A separate subnet for WAAS in the core or shared.
    We have to test failover, won't the traffic take an unoptimised path during failover , since there is no layer 2 between the DC's
    Appreciate your time
    Thanks
    Suja

  • Error while running a query-Input for variable 'Posting Period is invalid

    Hi All,
    NOTE: This error is only cropping up when I input 12 in the posting period variable selection. If I put in any other value from 1-11 I am not getting any errors. Any ideas why this might be happening?
    I am getting the following error when I try and run a query - "Input for variable 'Posting Period (Single entry, mandatory)' is invalid" - On further clicking on this error the message displayed is as follows -
    Diagnosis
    Variable Posting Period (Single Value Entry, Mandatory) is used as a lower limit (X) and an upper limit () in an interval selection. This limit has the value #.
    System Response
    Procedure
    Enter a different value for variable Posting Period (Single Value Entry, Mandatory). If the value of the other limit is determined by another variable, you can change its value also.
    Procedure for System Administration

    OK.
    Well, if the variable is not used in any interval selection, then I would say "something happened to it".
    I would make a copy of the query and run it to check if I get the same problem with period 12.
       -> If not, something is wrong in the original query (you can proceed as below, if changes to original are permitted).
    If so, then try removing the variable completely from the query and hardcode restriction to 12.
       -> If problem still persists, I would have to do some thinking.
    If problem is gone, then add the variable again. Check.
       -> If problem is back, then the variable "is sick". Only quick thing to do, is to build an identical variable and use that one.
    If problem also happens with the new variable, then it's time to share this experience with someone else and consider raising an OSS.
    Good luck!
    Jacob
    P.S: what fisc year variant are you using?
    Edited by: Jacob Jansen on Jan 25, 2010 8:36 PM

  • Logical database in adhoc query

    Hello All,
    Can anyone tell me what is the logical database in adhoc query?

    Hi
    When you create a query , you have to select an infoset. Infoset can be considered as a source from which data is populated in the Query Fields.
    Infosets are created from Transaction SQ02.
    There can be four methods through which an Infoset can become a source of data:
    1.  Table join ( By joining two or more tables from Data dictionary)
         example: Joining tables PA0001 and PA0006 on Pernr to get a one resultant dataset
    2. Direct read of Basis Table ( Like PA0001 as a source for data in Infoset )
    3. Logical Database ( A Pre-written Program by SAP that extract data from clusters, tables taking care of authorizations and validity periods)
    Example : Logical database PNP, PNPCE (Concurrent Employement),PCH ( LDB for Personnel Development Data)
    Custom Logical DBs can be created in T_Code SE-36.
    4. Data Retrieval by a Program ( Custom code written by ABAP developers which will collect and process data) . This program has a corresponding Structure in data dictionary and the fields of this structure will be used in query)
    Reward Points, if helpful.
    Regards
    Waseem Imran

  • Query help on Goods Receipt Query with AP Invoice

    Looking for a little help on a query.  I would like to list all the goods receipts for a given date range and then display the AP Invoice information (if its been copied to an AP Invoice).  I think my problem is in my where clause, I plagerized an SAP query to show GR and AP from a PO as a start.  SBO 2005 SP01.  Any help would be great appreciated.  Thanks
    SELECT distinct 'GR',
    D0.DocStatus,
    D0.DocNum ,
    D0.DocDate,
    D0.DocDueDate,
    D0.DocTotal,
    'AP',
    I0.DocStatus,
    I0.DocNum ,
    I0.DocDate,
    I0.DocDueDate,
    I0.DocTotal,
    I0.PaidToDate
    FROM
    ((OPDN  D0 inner Join PDN1 D1 on D0.DocEntry = D1.DocEntry)
    full outer join
    (OPCH I0 inner join PCH1 I1 on I0.DocEntry = I1.DocEntry)
    on (I1.BaseType=20 AND D1.DocEntry = I1.BaseEntry AND D1.LineNum=I1.BaseLine))
    WHERE
    (D1.BaseType=22 AND D1.DocDate>='[%0]' AND D1.DocDate<='[%1]')
    OR (I1.BaseType=20 AND I1.BaseEntry IN
    (SELECT Distinct DocEntry
    FROM PDN1 WHERE BaseType=22 AND DocDate>='[%0]' AND DocDate<='[%1]'))

    Hi Dalen ,
    I  believe it is because of the condition
    (D1.BaseType=22 AND D1.DocDate>='%0' AND D1.DocDate<='%1')
    OR (I1.BaseType=20 AND I1.BaseEntry IN
    (SELECT Distinct DocEntry FROM PDN1 WHERE PDN1.BaseType=22 AND DocDate>='%0' AND DocDate<='%1'))
    Try changing
    D1.BaseType=22 OR D1.DocDate>='%0' AND D1.DocDate<='%1
    PDN1.BaseType=22 OR DocDate>='%0' AND DocDate<='%1'))
    Lets see what would be the result . Lets have some fun with troubleshooting
    See what would be the difference in the result .
    Thank you
    Bishal

  • Can you check for data in one table or another but not both in one query?

    I have a situation where I need to link two tables together but the data may be in another (archive) table or different records are in both but I want the latest record from either table:
    ACCOUNT
    AccountID     Name   
    123               John Doe
    124               Jane Donaldson           
    125               Harold Douglas    
    MARKETER_ACCOUNT
    Key     AccountID     Marketer    StartDate     EndDate
    1001     123               10526          8/3/2008     9/27/2009
    1017     123               10987          9/28/2009     12/31/4712    (high date ~ which means currently with this marketer)
    1023     124               10541          12/03/2010     12/31/4712
    ARCHIVE
    Key     AccountID     Marketer    StartDate     EndDate
    1015     124               10526          8/3/2008     12/02/2010
    1033     125               10987         01/01/2011     01/31/2012  
    So my query needs to return the following:
    123     John Doe                        10526     8/3/2008     9/27/2009
    124     Jane Donaldson             10541     12/03/2010     12/31/4712     (this is the later of the two records for this account between archive and marketer_account tables)
    125     Harold Douglas               10987          01/01/2011     01/31/2012     (he is only in archive, so get this record)
    I'm unsure how to proceed in one query.  Note that I am reading in possibly multiple accounts at a time and returning a collection back to .net
    open CURSOR_ACCT
              select AccountID
              from
                     ACCOUNT A,
                     MARKETER_ACCOUNT M,
                     ARCHIVE R
               where A.AccountID = nvl((select max(M.EndDate) from Marketer_account M2
                                                    where M2.AccountID = A.AccountID),
                                                      (select max(R.EndDate) from Archive R2
                                                    where R2.AccountID = A.AccountID)
                   and upper(A.Name) like parameter || '%'
    <can you do a NVL like this?   probably not...   I want to be able to get the MAX record for that account off the MarketerACcount table OR the max record for that account off the Archive table, but not both>
    (parameter could be "DO", so I return all names starting with DO...)

    if I understand your description I would assume that for John Dow we would expect the second row from marketer_account  ("high date ~ which means currently with this marketer"). Here is a solution with analytic functions:
    drop table account;
    drop table marketer_account;
    drop table marketer_account_archive;
    create table account (
        id number
      , name varchar2(20)
    insert into account values (123, 'John Doe');
    insert into account values (124, 'Jane Donaldson');
    insert into account values (125, 'Harold Douglas');
    create table marketer_account (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account values (1001, 123, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('27.09.2009', 'dd.mm.yyyy'));
    insert into marketer_account values (1017, 123, 10987, to_date('28.09.2009', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    insert into marketer_account values (1023, 124, 10541, to_date('03.12.2010', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    create table marketer_account_archive (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account_archive values (1015, 124, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('02.12.2010', 'dd.mm.yyyy'));
    insert into marketer_account_archive values (1033, 125, 10987, to_date('01.01.2011', 'dd.mm.yyyy'), to_date('31.01.2012', 'dd.mm.yyyy'));
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account_archive;
    with
    basedata as (
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account_archive
    basedata_with_max_intervals as (
    select key, AccountId, MktKey, FromDt, ToDate
         , row_number() over(partition by AccountId order by FromDt desc) FromDt_Rank
      from basedata
    filtered_basedata as (
    select key, AccountId, MktKey, FromDt, ToDate from basedata_with_max_intervals where FromDt_Rank = 1
    select a.id
         , a.name
         , b.MktKey
         , b.FromDt
         , b.ToDate
      from account a
      join filtered_basedata b
        on (a.id = b.AccountId)
    ID NAME                     MKTKEY FROMDT     TODATE
    123 John Doe                  10987 28.09.2009 31.12.4712
    124 Jane Donaldson            10541 03.12.2010 31.12.4712
    125 Harold Douglas            10987 01.01.2011 31.01.2012
    If your tables are big it could be necessary to do the filtering (according to your condition) in an early step (the first CTE).
    Regards
    Martin

  • Query help : Query to get values SYSDATE-1 18:00 hrs to SYSDATE 08:00 hrs

    Hi Team
    I want the SQl query to get the data for the following comparison : -
    Order Created is a Date Column , and i want to find out all the values from (SYSDATE-1) 18:00 hours to SYSDATE 08:00 hours
    i.e.
    (SYSDATE-1) 18:00:00 < Order.Created < SYSDATE 08:00:00.
    Regards

    Hi, Rohit,
    942281 wrote:
    If i want the data in the below way i.e.
    from (SYSDATE-1) 18:00 hours to SYSDATE 17:59 hours ---> (SYSDATE-1) 18:00:00 < Order.Created < SYSDATE 07:59:00.If you want to include rows from exactly 18:00:00 yesterday (but no earlier), and exclude rows from exatly 08:00:00 today (or later), then use:
    WHERE   ord_dtl.submit_dt  >= TRUNC (SYSDATE) - (6 / 24)
    AND     ord_dtl.submit_dt  <  TRUNC (SYSDATE) + (8 / 24)
    So can i use the below format : -
    ord_dtl.submit_dt BETWEEN trunc(sysdate)-(6/24) and trunc(sysdate)+(7.59/24) . Please suggest . .59 hours is .59 * 60 * 60 = 2124 seconds (or .59 * 60 = 35.4 minutes), so the last time included in the range above is 07:35:24, not 07:59:59.
    If you really, really want to use BETWEEN (which includes both end points), then you could do it with date arithmentic:
    WHERE   ord_dtl.submit_dt  BETWEEN  TRUNC (SYSDATE) - (6 / 24)
                      AND         TRUNC (SYSDATE) + (8 / 24)
                                               - (1 / (24 * 60 * 60))but it would be simpler and less error prone to use INTERVALs, as Karthick suggested earlier:
    WHERE   ord_dtl.submit_dt  BETWEEN  TRUNC (SYSDATE) - INTERVAL '6' HOUR
                      AND         TRUNC (SYSDATE) + INTERVAL '8' HOUR
                                               - INTERVAL '1' SECONDEdited by: Frank Kulash on Apr 17, 2013 9:36 AM
    Edited by: Frank Kulash on Apr 17, 2013 11:56 AM
    Changed "- (8 /24)" to "+ (8 /24)" in first code fragment (after Blushadown, below)

  • Query help, subtract two query parts

    Hi,
    I am beginner of PL/SQL and have a problem I couldn’t solve:
    Table (op_list):
    Item     -     Amount -     Status
    Item1     -     10     -     in
    Item2     -     12     -     in
    Item3     -     7     -     in
    Item1     -     2     -     out
    Item2     -     3     -     out
    Item1     -     1     -     dmg
    Item3     -     3     -     out
    Item1     -     2     -     out
    Item2     -     5     -     out
    Item2     -     2     -     in
    Item3     -     1     -     exp
    Would like to get result of query (subtract amount of 'out/dmg/exp' from 'in' ):
    Item - Amount left
    Item1     -     5
    Item2     -     6
    Item3 -     3
    I wrote code that returns sum of all incoming items and sum all out/dmg/exp items, but couldn’t solve how to subtract one part of querry from another. Or maybe there is a better way. Also worried what happens if there is no 'out/dmg/exp' only 'in'
    select item.name, sum(op_list.item_amount)
    from op_list
    inner join item
    on op_list.item = item.item_id
    where op_list.status = 'in'
    group by item.name
    union
    select item.name, sum(op_list.item_amount)
    from op_list
    inner join item
    on op_list.item = item.item_id
    where op_list.status = 'out'
    or op_list.status = 'dmg'
    or op_list.status = 'exp'
    group by item.name
    Return:
    Item1     -     10      [10 in]
    Item1     -     5     [2+1+2]
    Item2     -     14     [12+2]
    Item3     -     7
    Item3     -     4     [3+1]
    Thanks in advance

    Hi,
    We can also use simple inline views to get what we need.
    select a.item,a.amount-b.amount Balance from
    (select item,sum(amount) Amount from op_list
    where status = 'in'
    group by item) a,
    (select item,sum(amount) Amount from op_list
    where status in ('out','dmg','exp')
    group by item) b
    where
    a.item=b.item
    order by item;
    ITEM       BALANCE
    Item1                      5
    Item2                      6
    Item3                      3Regards,
    Prazy

  • Query help: query to return column that represents multiple rows

    I have a table with a name and location column. The same name can occur multiple times with any arbitrary location, i.e. duplicates are allowed.
    I need a query to find all names that occur in both of two separate locations.
    For example,
    bob usa
    bob mexico
    dot mexico
    dot europe
    hal usa
    hal europe
    sal usa
    sal mexico
    The query in question, if given the locations usa and mexico, would return bob and sal.
    Thanks for any help or advice,
    -=beeky

    How about this?
    SELECT  NAME
    FROM    <LOCATIONS_TABLE>
    WHERE   LOCATION IN ('usa','mexico')
    GROUP BY NAME
    HAVING COUNT(DISTINCT LOCATION) >= 2Results:
    SQL> WITH person_locations AS
      2  (
      3          SELECT 'bob' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      4          SELECT 'bob' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      5          SELECT 'dot' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      6          SELECT 'dot' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      7          SELECT 'hal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      8          SELECT 'hal' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      9          SELECT 'sal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
    10          SELECT 'sal' AS NAME, 'Mexico' AS LOCATION FROM DUAL
    11  )
    12  SELECT  NAME
    13  FROM    person_locations
    14  WHERE   LOCATION IN ('USA','Mexico')
    15  GROUP BY NAME
    16  HAVING COUNT(DISTINCT LOCATION) >= 2
    17  /
    NAM
    bob
    salHTH!
    Edited by: Centinul on Oct 15, 2009 2:25 PM
    Added sample results.

  • QUERY HELP!!! trying to create a query

    i'm creating a summary report
    i have a table with sale dates
    for example i have a table tab_1 and column saleDate as
    saleDat
    1923
    1936
    1945
    2003
    2005
    saleDate contains years and there are some missing years where no sale
    was made
    My report has to display years starting from earliest year
    so i have to create a query that starts with 1923
    but the problem is that I have to have years that are not in table.
    for example i have to display years 1924 which is not in table
    so the part of report has to look like
    1923 blah blah summary.........
    1924 "
    1925
    1926
    2005
    2006
    upto current year (2006 may not be in the table, but i have to display)
    i just need to know the query that can query all the years starting from
    the ealiest saleDate to current year
    thanks in advance

    Please write the query in the following form:
    SELECT a.year, --- place other columns from your table.
    FROM (SELECT (:start_num + rownum) year
    FROM all_tab_columns
    WHERE :start_num + rownum <= :end_num) a,
    tab_1 b
    WHERE a.year = b.saleDat(+);
    Note:
    1) if your start year and end year are 1923 and 2006. Then input as below:
    :start_num = 1922
    :end_num = 2006
    2) Since for some of the years (1924 etc) may not be there in your so you may need to use NVL to print proper indicators.
    3) If you have more than one record in tab_1 for a particular year then group them based year and then use it.
    Hope this helps.
    - Saumen.

Maybe you are looking for