Problem in adding one condition in where clause

Hi,
I am populating this internal table t_bkpf for all entries in gt_covp_ext
  select bukrs belnr gjahr
         bldat budat cpudt
         xblnr waers awtyp awkey
         from bkpf
         into corresponding fields of table t_bkpf
         for all entries in gt_covp_ext
         where bukrs eq gt_covp_ext-bukrs and
               awtyp eq 'MKPF'.
Here i have to add one more condition in where clause
AWKEY = ( Concatenated string of gt_covp_ext-REFBN + gt_covp_ext-REFGJ )
As i am not using loop at gt_covp_ext.How to implement this condition in Where clause.
Please help.If you did not understood the requirement reply this post.
Mukesh Kumar
Message was edited by:
        mukesh kumar

Hi,
Create a new internal table gt_covp_ext_new with the same structure as gt_covp_ext. Include an extra field in gt_covp_ext_new-concat,  to store the concatenated value.
Copy all entries from gt_covp_ext to gt_covp_ext_new.
Loop at gt_covp_ext.
move-corresponding gt_covp_ext to gt_covp_ext_new.
gt_covp_ext_new-concat = gt_covp_ext-REFBN + gt_covp_ext-REFGJ .
append gt_covp_ext_new.
endloop.
Now use this new internal table in the query.
select bukrs belnr gjahr
bldat budat cpudt
xblnr waers awtyp awkey
from bkpf
into corresponding fields of table t_bkpf
for all entries in gt_covp_ext_new
where bukrs eq gt_covp_ext_new-bukrs and
awkey eq  gt_covp_ext_new-concat and
awtyp eq 'MKPF'.
Hope this answers your qn.
Regards,
Divya

Similar Messages

  • Problem in case of or condition in  where clause in case of leftouter joi.

    hi
    i am encountering a wierd problem.
    in a select query if i have a left outer join and a or condition in where clause the order of condition in or matters and if i use a to_char problem is solved.
    see query below
    select * from custsupp left outer join Salesperson s on custsupp.sales_rep = s.id ,state a where (CS_FLAG='C' or CS_flag ='B') and custsupp.state = a.id
    i have a single record in table custsupp with CS_FLAG ='B' the above does not return result. but if i move CS_FLAG='B' on left of or i.e
    select * from custsupp left outer join Salesperson s on custsupp.sales_rep = s.id ,state a where (CS_FLAG='B' or CS_flag ='C') and custsupp.state = a.id
    i get the rsult.
    also if i remove left outer join and keep order of condition as it is i get result i.e
    select * from custsupp ,state a where (CS_FLAG='C' or CS_flag ='B') and custsupp.state = a.id
    also if i add a to_char to co,umns CS_FLAG i get the result.
    select * from custsupp left outer join Salesperson s on custsupp.sales_rep = s.id ,state a where (to_char(CS_FLAG)='C' or to_char(CS_flag ='B')) and custsupp.state = a.id
    why it is so?
    CS_flag is of type nchar
    Shreyas
    Edited by: shreyasd on Jun 9, 2010 11:07 PM

    First if you don't want to take credit of the free sample then follow the below procedure:
    1. Do the GRN for all the three item and for the free item in the excise tab at the item level select the material as non cenvatable. Just remember to add base value of the item
    2.  If you want to capture the Part1 entry then just do the normal transaction and while posting the excise with J1IEX just remove the excise duties for the free item.
    3. For paying the vendor the excise amount, just do subsequent debit in the MIRO and in the details tab add in the unplanned delivery cost the amount that you want to pay for the excise duties
    Second case if you want to take credit of the duties:
    1. Do the Normal GRN process, add the base value and excise values for the free item.
    2. Post the Excise duites with J1iEX.
    3. The with the account entry you can settle the excise payment
    Hope this will help you
    Enjoyyyyyyyyyyy
    Akshit

  • How can I pass multiple condition in where clause with the join table?

    Hi:
    I need to collect several inputs at run time, and query the record according to the input.
    How can I pass multiple conditions in where clause with the join table?
    Thanks in advance for any help.
    Regards,
    TD

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

  • How to use the MAX DATE condition in WHERE CLAUSE FILEDS

    Hi,
    I am trying to fetch the result for getting maximun date but when i try to execute the query i am getting the error as follows.
    CONDITION : trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')
    ERROR: Group function is not allowed here.
    CHEERS,
    PRABU AMMAIAPPAN

    I see a couple of problems here.
    First, what you posted below is not a syntactically valid query. It seems to be part of a larger query, specifically, this looks to be only the GROUP BY clause of a query.
    Prabu ammaiappan wrote:
    Hi,
    I Have a group function in the Query. Below is the Query i have used it,
    GROUP BY S.FREIGHTCLASS,
    R.CONTAINERKEY,
    S.SKU,
    S.DESCR ||S.DESCRIPTION2,
    S.PVTYPE,
    RD.LOTTABLE06,
    R.WAREHOUSEREFERENCE,
    RD.TOLOC,
    R.ADDWHO,
    R.TYPE,
    S.CWFLAG,
    S.STDNETWGT,
    S.ORDERUOM,
    R.ADDDATE,
    C.DESCRIPTION,
    (CASE WHEN P.POKEY LIKE '%PUR%' THEN 'NULL' ELSE to_char(P.PODATE,'dd/mm/yyyy') END),
    NVL((CASE WHEN R.ADDWHO='BOOMI' THEN RDD.SUPPLIERNAME END),SS.COMPANY),
    RDD.BRAND,
    S.NAPA,
    RD.RECEIPTKEY,
    R.SUSR4,
    P.POKEY,
    RDD.SUSR1,
    r.STATUS, DECODE(RDD.SUSR2,' ',0,'',0,RDD.SUSR2),
    rd.SUSR3Second, the answer to your primary question, "How do I add a predicate with with a MAX() function to my where clause?" is that you don't. As you discovered, if you attempt to do so, you'll find it doesn't work. If you stop and think about how SQL is processed, it should make sense to you why the SQL is not valid.
    If you want to apply a filter condition such as:
    trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')you should do it in a HAVING clause, not a where clause:
    select ....
      from ....
    where ....
    group by ....
    having max(some_date) between this_date and that_date;Hope that helps,
    -Mark

  • How to change operator of join conditions in where clause?

    Hello
    I have a situation... I want to change the operator between each join conditions in the where clause when these join conditions are not from the same join..
    For example, I have the following schema:
    Dim1 ------ DimA -------Fact1
    Dim1-------DimB -----Fact1
    So DimA and DimB are aliasas of one dim table, but the join is different.
    Now if I run this model, what I will get in the where clause of the query is:
    Where Dim1 = DimA and Dim1 = DimB and DimA= Fact1 and DimB = fact1.
    Is there a way I can change these "and" operator to "OR", so that the where clause would look like this: Where Dim1 = DimA and Dim1 = DimB and DimA= Fact1 OR DimB = fact1?
    This is different from simply changing the join operator within the same join, because these are different joins and I'd like to control how they relate to each other..
    Please help
    Thanks

    Sometimes, business rules are complex, so there isn't always a way to simplify things.  Is your issue that it's complex and error prone, or is it performance due to the OR clauses?
    One possibility that will at least make it easier to test and debug is something like this:  (pseudocode)
    From Table1 Inner join Table2 on x=y etc.etc.
    CROSS APPLY
    (Select case when a=b and (c=d or e=f) then 1 else 0 end) as Situation1
    , case when h=i or j = k then 1 else 0 end) as situation2
    , case when l = m then 1 else 0 end) as situation 3
    ) as CA_Logic_Simplifier
    Where situation1 = 1 and situation2 = 1 and situation3 = 1
    Although you could say, "Hey, this is basically doing the same thing as before", this approach would be far easier to test and debug, because you can at a glance look at the values for situation1, 2, 3, etc. to see where errors are being introduced. 
    The cross apply makes the columns situation1/2/3 "instantiated", so they are usable in the where clause. Divide and conquer.  

  • EQUAL condition on WHERE clause not working

    Hi,
    Can someone please tell me why the following WHERE clause  (marked with ***** below) is not finding any EQUAL conditions?
    I know that table i_cust_mast is populated with several thousand rows and that there ARE matching rows in KNVP.
    Here is the code as I have it:
    TYPES:
          BEGIN OF t_cust_mast,
            kunnr TYPE kunnr,
            name1 TYPE name1_gp,
            name2 TYPE name2_gp,
            stras TYPE stras_gp,
            adrnr TYPE adrnr,
            ort01 TYPE ort01_gp,
            regio TYPE regio,
            pstlz TYPE pstlz,
            vkbur TYPE vkbur,
            konda TYPE konda,
            sortl TYPE sortl,
            katr1 TYPE katr1,
            katr2 TYPE katr2,
            katr3 TYPE katr3,
            katr4 TYPE katr4,
            katr5 TYPE katr5,
            katr6 TYPE katr6,
            katr7 TYPE katr7,
            katr8 TYPE katr8,
            katr9 TYPE katr9,
            katr10 TYPE katr10,
            bzirk TYPE bzirk,
            vkgrp TYPE vkgrp,
            kdgrp TYPE kdgrp,
            klabc TYPE klabc,
            kondaa TYPE konda,
            kalks TYPE kalks,
            pltyp TYPE pltyp,
            hityp TYPE hityp_kh,
            hkunnr TYPE hkunnr_kh,
            datab TYPE datab,
            datbi TYPE datbi,
            lzone TYPE lzone,
          parvw TYPE parvw,
            kunn2 TYPE kunn2,
            kunn2a TYPE kunn2,
            kunn2b TYPE kunn2,
            kunn2c TYPE kunn2,
            kunn2d TYPE kunn2,
            kunn2e TYPE kunn2,
            kunn2f TYPE kunn2,
            kunn2g TYPE kunn2,
            parza TYPE parza,
            ktokd TYPE ktokd,
            loevm TYPE loevm_x,
          END OF t_cust_mast .
        TYPES:
          BEGIN OF t_part_func,
            kunnr TYPE kunnr,
            parvw type parvw,
            kunn2 TYPE kunn2,
            parza type parza,
          END OF t_part_func .
        TYPES:
          t_t_cust_mast TYPE STANDARD TABLE OF t_cust_mast,
          t_t_part_func TYPE STANDARD TABLE OF t_part_func.
        DATA: i_cust_mast TYPE t_t_cust_mast,
              i_part_func TYPE t_t_part_func.
      CONSTANTS: c_type_a TYPE msgty VALUE 'A'.
      FIELD-SYMBOLS: <x_cm> LIKE LINE OF i_cust_mast.
    Get Customer Master Data
      SELECT
       hkunnr hname1 hname2 hstras hadrnr hort01 h~regio
       hpstlz ivkbur ikonda hsortl hkatr1 hkatr2 h~katr3
       hkatr4 hkatr5 hkatr6 hkatr7 hkatr8 hkatr9 h~katr10
       ibzirk ivkgrp ikdgrp iklabc ikonda ikalks i~pltyp
       khityp khkunnr kdatab kdatbi h~lzone
       hktokd hloevm
      INTO TABLE i_cust_mast " up to 50 rows
      FROM kna1 AS h
      JOIN knvv AS i ON ikunnr = hkunnr
      JOIN knvh AS k ON hityp = c_type_a   " 'A'
                    AND kkunnr = ikunnr
                    AND kvkorg = ivkorg
                    AND kvtweg = ivtweg
                    AND kspart = ispart
                    AND k~datab <= sy-datum
                    AND k~datbi >= sy-datum.
      IF sy-subrc = 0.
        SORT i_cust_mast[] BY kunnr.
      ENDIF.
    Get Partner Function Data for each Customer Master Record
      LOOP AT i_cust_mast ASSIGNING <x_cm>.
        SELECT hkunnr hparvw hkunn2 hparza
          INTO TABLE i_part_func
        FROM knvp AS h
          WHERE h~kunnr = <x_cm>-kunnr.        ***** WHERE clause not finding any matches *****
      ENDLOOP.
    Thanks!!!
    Andy

    TYPES:
          BEGIN OF t_cust_mast,
            kunnr TYPE kunnr,
            name1 TYPE name1_gp,
            name2 TYPE name2_gp,
            stras TYPE stras_gp,
            adrnr TYPE adrnr,
            ort01 TYPE ort01_gp,
            regio TYPE regio,
            pstlz TYPE pstlz,
            vkbur TYPE vkbur,
            konda TYPE konda,
            sortl TYPE sortl,
            katr1 TYPE katr1,
            katr2 TYPE katr2,
            katr3 TYPE katr3,
            katr4 TYPE katr4,
            katr5 TYPE katr5,
            katr6 TYPE katr6,
            katr7 TYPE katr7,
            katr8 TYPE katr8,
            katr9 TYPE katr9,
            katr10 TYPE katr10,
            bzirk TYPE bzirk,
            vkgrp TYPE vkgrp,
            kdgrp TYPE kdgrp,
            klabc TYPE klabc,
            kondaa TYPE konda,
            kalks TYPE kalks,
            pltyp TYPE pltyp,
            hityp TYPE hityp_kh,
            hkunnr TYPE hkunnr_kh,
            datab TYPE datab,
            datbi TYPE datbi,
            lzone TYPE lzone,
          parvw TYPE parvw,
            kunn2 TYPE kunn2,
            kunn2a TYPE kunn2,
            kunn2b TYPE kunn2,
            kunn2c TYPE kunn2,
            kunn2d TYPE kunn2,
            kunn2e TYPE kunn2,
            kunn2f TYPE kunn2,
            kunn2g TYPE kunn2,
            parza TYPE parza,
            ktokd TYPE ktokd,
            loevm TYPE loevm_x,
          END OF t_cust_mast .
        TYPES:
          BEGIN OF t_part_func,
            kunnr TYPE kunnr,
            parvw type parvw,
            kunn2 TYPE kunn2,
            parza type parza,
          END OF t_part_func .
        TYPES:
          t_t_cust_mast TYPE STANDARD TABLE OF t_cust_mast,
          t_t_part_func TYPE STANDARD TABLE OF t_part_func.
        DATA: i_cust_mast TYPE t_t_cust_mast,
              i_part_func TYPE t_t_part_func. 
    CONSTANTS: c_type_a TYPE msgty VALUE 'A'.
      FIELD-SYMBOLS: <x_cm> LIKE LINE OF i_cust_mast.
    Get Customer Master Data
      SELECT
       hkunnr hname1 hname2 hstras hadrnr hort01 h~regio
       hpstlz ivkbur ikonda hsortl hkatr1 hkatr2 h~katr3
       hkatr4 hkatr5 hkatr6 hkatr7 hkatr8 hkatr9 h~katr10
       ibzirk ivkgrp ikdgrp iklabc ikonda ikalks i~pltyp
       khityp khkunnr kdatab kdatbi h~lzone
       hktokd hloevm
      INTO TABLE i_cust_mast " up to 50 rows
      FROM kna1 AS h
      JOIN knvv AS i ON ikunnr = hkunnr
      JOIN knvh AS k ON hityp = c_type_a   " 'A'
                    AND kkunnr = ikunnr
                    AND kvkorg = ivkorg
                    AND kvtweg = ivtweg
                    AND kspart = ispart
                    AND k~datab <= sy-datum
                    AND k~datbi >= sy-datum.
      IF sy-subrc = 0.
        SORT i_cust_mast[] BY kunnr.
      ENDIF.
    Get Partner Function Data for each Customer Master Record
      LOOP AT i_cust_mast ASSIGNING <x_cm>.
        SELECT hkunnr hparvw hkunn2 hparza
          INTO TABLE i_part_func
        FROM knvp AS h
          WHERE h~kunnr = <x_cm>-kunnr.
      ENDLOOP.

  • Problem with to_date('date_char') in a where clause

    A little confused with this plsql error.
    This code works...
    select to_date(value,'dd/mm/yy') from kip_lov where domain='MODULE START1'
    If I try to put the "to_date(value,'dd/mm/yy')" expression in the where clause I get an invalid year error,
    select to_date(value,'dd/mm/yy') from kip_lov where domain='MODULE START1'
    AND to_date(value,'dd/mm/yy') = SYSDATE
    "Error report:
    SQL Error: ORA-01841: (full) year must be between -4713 and +9999, and not be 0"
    The variable "value" is a varchar2 in the format dd/mm/yy.
    Note: the following code also works fine,
    select to_date(value,'dd/mm/yy') - sysdate from kip_lov where domain='MODULE START1'
    I have modified my lov table so that it uses the date type now and it works fine. Just curious as to why the above example does not work.
    Sam.

    check your table description and values first, is there any dd/mm/yy or mm/dd/yy confliction
    A scenario which runs.
    SQL> desc trya
    Name Null? Type
    UPDATED_ON DATE
    UPD VARCHAR2(8)
    SQL> select * from trya
    2 ;
    UPDATED_O UPD
    31-JUL-06 31/07/06
    31-JUL-06 31/07/06
    31-JUL-06 31/07/06
    31-JUL-06 31/07/06
    31-JUL-06 31/07/06
    31-JUL-06 31/07/06
    31-JUL-06 31/07/06
    31-JUL-06 31/07/06
    31-JUL-06 31/07/06
    31-JUL-06 31/07/06
    31-JUL-06 31/07/06
    UPDATED_O UPD
    31-JUL-06 31/07/06
    31-JUL-06 31/07/06
    13 rows selected.
    SQL> SELECT * FROM trya WHERE TO_CHAR(TO_DATE(upd,'dd/mm/yy'))=SYSDATE;
    no rows selected
    SQL> SELECT * FROM trya WHERE TO_DATE(upd,'dd/mm/yy')=SYSDATE;
    no rows selected
    SQL>
    NO error on both syntax
    rgds,
    Rup

  • Case condition in where clause

    Hi
    I'm a SQL beginner but according to my reading of the manual, this syntax should be acceptable. I'm using it in application express but tested it also in SQL developer and finding that it fails with an "invalid relational operator" error, with the line number pointing to the ELSE clause of the CASE condition, but a column number pointing to white space.
    This is a nested select but that shouldn't matter. The fragment in question is this:
    select some columns
    from res
    where res.villaid = :P605_VILLAID
    and INSTR(:P604_RES_STATES, res.states) != 0
    and (CASE :P604_EXCLUDE_ZERO
    WHEN 'Y' THEN 'res.rate > 0'
    ELSE 'res.rate >= 0'
    END)
    and res.DEPARTDATE > :P605_STARTDATE
    and res.ARRIVEDATE <= :P605_ENDDATE,
    I hope this formats ok when posted. The code is looking for reservations in a date range (which works fine when the other conditions are commented out), and should only output zero-rate rows (complimentary nights) if the user asks for this in the P604_EXCLUDE_ZERO bind variable. There are probably other ways to go about this, but I am too stubborn to give up on this. Well, not yet anyway.
    Thanks and regards
    CS

    select some columns
      from res
    where res.villaid = :p605_villaid
           and instr (:p604_res_states, res.states) != 0
           and sign (res.rate) >= case when :p604_exclude_zero = 'Y' then 1 else 0 end
           and res.departdate > :p605_startdate
           and res.arrivedate <= :p605_enddate

  • Retrieve List Items based on condition in Where Clause

    Hello Experts,
     I am trying to retrieve list items from a list (CityList)  which contains 2 columns one is city(string) and State(Lookup) based on Lookup value, but i am getting all city names.
    here is my query below.
    function MainFunction() {
            var lookupid = 5;
            var myQueryString = "<Where><Eq><FieldRef Name='State' LookupId='true' /><Value Type='Lookup'>"+lookupid+"</Value></Eq></Where>";
            var myContext = new SP.ClientContext.get_current(); ;
            var myWeb = myContext.get_web();
            var myList = myWeb.get_lists().getByTitle("CityList");
            var myQuery = new SP.CamlQuery();
            myQuery.set_viewXml(myQueryString);    
            myItems = myList.getItems(myQuery);
            myContext.load(myItems, 'Include(Title)'); 
            myContext.executeQueryAsync(Function.createDelegate(this, GetListDataSuccess), Function.createDelegate(
    this, GetListDataFail));
        function GetListDataFail(sender, args) {
            // Show error message
            alert('GetListDataFail() failed:' + args.get_message());
        function GetListDataSuccess(sender, args) {
            var currListItemCount = myItems.get_count();       
            var currItemEnumerator = myItems.getEnumerator();
            var currItemDetails = '';       
            while (currItemEnumerator.moveNext()) {          
                var currItem = currItemEnumerator.get_current();          
                 currItemDetails = currItemDetails + ';' + currItem.get_item("Title");
            // Show details 
            alert(currItemDetails); 
    Please suggest where i am wrong. 
    Thank you
    saroj

    You need to enclose the <Where> tag inside <View><Query> . Try like below
    var myQueryString = "<View><Query><Where><Eq><FieldRef Name='State' LookupId='TRUE' />
    <Value Type='Lookup'>"+lookupid+"</Value></Eq></Where></Query></View>";
    Geetanjali Arora | My blogs |

  • Problem by adding one spatial column to the version-enabled table

    Hello, I'm trying to modify one version-enabled table T1 like this:
    --table definition
    create table T1
    (ID NUMBER NOT NULL PRIMARY KEY,
    NAME VARCHAR2 (256),
    FUNCTION VARCHAR2 (256));
    --enable versioning
    EXECUTE DBMS_WM.EnableVersioning('T1','VIEW_WO_OVERWRITE');
    I'd like to add one spatial column to this table by:
    -- modify metada view for spatial indexing
    INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
    VALUES ('T1_LT', 'ANCHOR',
    MDSYS.SDO_DIM_ARRAY
    (MDSYS.SDO_DIM_ELEMENT('X', 0.000, 100000.000, 0.0005),
    MDSYS.SDO_DIM_ELEMENT('Y', 0.000, 100000.000, 0.0005),
    MDSYS.SDO_DIM_ELEMENT('Z', -100, 1000, 0.0005)) , 81989002);
    -- table modification - add a column and create a spatial index
    EXECUTE DBMS_WM.BeginDDL('T1');
    ALTER TABLE T1_LTS ADD ("ANCHOR" MDSYS.SDO_GEOMETRY);
    CREATE INDEX T1_SPX on T1_LTS(ANCHOR) INDEXTYPE is MDSYS.SPATIAL_INDEX;
    EXECUTE DBMS_WM.CommitDDL('T1');
    By finishing of the DDL operation with EXECUTE DBMS_WM.CommitDDL('T1') I get an error message:
    "SQL> EXECUTE DBMS_WM.CommitDDL('T1');
    BEGIN DBMS_WM.CommitDDL('T1'); END;
    ERROR at line 1:
    ORA-20171: WM error: 'CREATE TABLE' and 'CREATE SEQUENCE' privileges needed.
    ORA-06512: at "SYS.WM_ERROR", line 342
    ORA-06512: at "SYS.WM_ERROR", line 359
    ORA-06512: at "SYS.LTUTIL", line 8016
    ORA-06512: at "SYS.LT", line 11925
    ORA-06512: at line 1
    What is wrong here? The Oracle 10g DB is installed on Windows 2003 Server, OWM_VERSION - 10.2.0.1.0.
    Regards,
    Viktor

    Hi,
    You need to explicitly grant the create table and create sequence privileges to the user owning the table. It is not enough for these to be granted by using a role. This restriction is documented in the user guide.
    Also, you should add the entry in the user_sdo_geom_metadata view on the t1_lts table, which is the table to which you are actually adding the geometry column, after calling beginDDL. CommitDDL will make the necessary changes, which in this case would be to add an entry for both t1 and t1_lt.
    Regards,
    Ben

  • Please help to build an sql from the given expression to build case condition with Where clause

    if  @rollno is not null then
    Select top  1 studentid  from student where rollno =:@rollno
    else
    if @regno is not null then
    Select top  1 studentid  from student where regno =:@regno
    Please help me to create  the above condition as  a single  sql statement . I will pass two argument in to the sql.
    With Thanks
    Pol
    polachan

    Select top 1 studentid from student
    where (rollno =:@rollno or :@rollno is null)
    and (regno =:@regno or :@regno is null)
    The above expression will work in SQL server
    I'm not sure you're using sql server as syntax like :@regno are not t-sql valid
    so you can try the above and if it doesnt work please try in the relevant forums for more help in case you're using a different RDBMS
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Need multiple Condition in Where Clause

    Hi,
    I have a table like below
    CREATE TABLE LedgerTable (Particulars varchar(200),Debit decimal(18,3), Credit decimal(18,3), Category varchar(200));
    INSERT into LedgerTable (Particulars, Debit, Credit, Category) values
    ('Asset', 0,80, 'Class'), ('CASH1', 0,100, 'Control'),('CASH2', 0,0, 'Control'),('Fittings', 20,0, 'Control'),('Furniture', 0,0, 'Control')
    i have a flag @suppressZero.
    If its 1 then need the result like below 
    i need to use @suppressZero in where condition
    Thanks and Regards
    Kasim

    Hi Latheesh,
    Thanks, but in my scenario i need to display record with category='Class' even if its 0 but not 'Control'
    i changed this like below
    elect * From LedgerTable Where (@suppressZero =1 and (Debit + Credit >0) or Category='Class') OR (@suppressZero=0)
    anyway thanks again

  • Hi, I have a problem with adding one song to existing album in my itunes, how to do it ?

    This is is always added separately like new album, if I rename it to existing album, it's always stay separately.

    Take a look at my article on Grouping tracks into Albums, in particular the topic Tried that, there are STILL too many covers!.
    tt2

  • How to use maximum date condition in where clause ?

    Hi I want to check if SWITCH_FLAG has 'Y' for the latest batch run..how can write it?
    (select a.SWITCH_FLAG
    from MORTGAGE
    where SYS_EFF_DATE = max(SYS_EFF_DATE)
    ) as expected_result
    Error message:
    ORA-00934: group function is not allowed here

    This will give you the switch_flag for the latest eff_date,
    SELECT SWITCH_FLAG
      FROM (SELECT A.SWITCH_FLAG, ROW_NUMBER () OVER (ORDER BY SYS_EFF_DATE DESC) rn
              FROM mortgage A)
    WHERE rn = 1;
    --if you want to test try this,
    SELECT SWITCH_FLAG,SYS_EFF_DATE
      FROM (SELECT A.SWITCH_FLAG,SYS_EFF_DATE , ROW_NUMBER () OVER (ORDER BY SYS_EFF_DATE DESC) rn
              FROM mortgage A)
    WHERE rn = 1;G.

  • HT4314 I m having problem with adding one more Id to my same Game Center account!!   It says "email Id unavailable " but this is mine Id only? And can u also tell me what it means?

    Hi plz tell answer of my question. I m not being able to add my friends due to this problem!

    Luxury, Julie! I can't even get past the “Nickname” window. I put in a nickname and press the “Continue” button. Another pool-table-felt-green window appears, empty except for the spinning pinwheel (“doing something…”) in the middle. After a couple of hours mesmerized by this wonderful phenomenon, I figure I didn't want to see what "Game Center" is, anyway.

Maybe you are looking for

  • Why can't I sent or reply from my iPhone 5C from Cogeco?

    I had the iphone 4s and it worked perfectly. Because I cracked the screen 2 times and i was eligible for an upgrade I went with the 5c and it's been a nightmare I have a cogeco email, which I've used for 14 years in business. Now I can't reply or com

  • In need of favicon assistance

    I've read some insightful suggestions from several people here, but am having a heck of a time trying to put a favicon on my website. I've followed scripting directions, but I guess I'm looking for an idiot's guide (the idiot would be me) step by ste

  • Executing SQL query in portal database

    Hi ,    I wish to do a simple POC . I need to create a table from NWDS , populate it with some data and then access the table data using an sql query . I am aware how to create a table but I am not sure where exactly to write the query . What I would

  • My daughter can read my iMessages sent to her phone

    I've been trying to figure out how to get my messages off of her iPhone. She updated her iPhone with the newest software, 6.1.3 and accidentally added my number/ account to her phone when asked about accounts so now she is able to read imessages sent

  • Dead pixels on late 2012 27-inch iMac

    i've been using the default configured starry Galaxy desktop wallpaper since i bought my iMac 27-inch late 2012 and today i noticed a small light spot near one of the small stars on the left side of my screen, it is mostly noticeable standing up and