How to use allies names in ON condition

i have the following query.
SELECT
DD.DATE_KEY
, (SELECT MIN(NVI_DATE) AS NVI_MIN_DATE FROM FCT_SPA_NVI_OUTRIGHT A WHERE A.VENDOR_CODE=V.VENDOR_CODE) AS NVI_MIN_DATE
, VO.BANK_ACCOUNT_NO
, VO.BANK_NAME
, VO.BANK_ROUTING_NO
FROM DIM_VENDOR V
LEFT JOIN FCT_SPA_NVI_OUTRIGHT VO
ON V.VENDOR_CODE = VO.VENDOR_CODE
LEFT JOIN FCT_SPA_NVI_MERCHANDISE VP
ON VO.NVI_KEY=VP.NVI_KEY
LEFT JOIN DIM_DATE DD
ON VO.NVI_DATE=DD.DATE_FLD
in the above query, how to use NVI_MIN_DATE in the ON condItion like.,
LEFT JOIN DIM_DATE DD
ON NVI_MIN_DATE=DD.DATE_FLD
Thanks in advance.
bala krishna

Try using a CTE, so something like this.
WITH TableA (NVI_MIN_DATE, BANK_ACCOUNT_NO, BANK_NAME, BANK_ROUTING_NO)
AS
SELECT
(SELECT MIN(NVI_DATE) AS NVI_MIN_DATE FROM FCT_SPA_NVI_OUTRIGHT A WHERE A.VENDOR_CODE=V.VENDOR_CODE) AS NVI_MIN_DATE,
VO.BANK_ACCOUNT_NO,
VO.BANK_NAME,
VO.BANK_ROUTING_NO
FROM DIM_VENDOR V
LEFT JOIN FCT_SPA_NVI_OUTRIGHT VO
ON V.VENDOR_CODE = VO.VENDOR_CODE
LEFT JOIN FCT_SPA_NVI_MERCHANDISE VP
ON VO.NVI_KEY=VP.NVI_KEY
SELECT
DD.DATE_KEY,
TableA.*
FROM TableA
LEFT JOIN DIM_DATE DD ON
TableA.NVI_DATE=DD.DATE_FLD
John Sansom | SQL Server MCM
Blog |
Twitter | LinkedIn |
SQL Consulting

Similar Messages

  • How to use MONTH NAME in where condition in date column?

    Hi dudes,
    this is the table.
    sql>desc ACMINUTESPDFTEST;
    Name Null? Type
    ACDATE DATE
    TYPES VARCHAR2(10)
    here i have tried the following 2 queries,but i could not get the correct result
    select types,seqno,acdate from ACMINUTESPDFTEST where acdate like to_date('NOV','MON');
    or
    select types,seqno,acdate from ACMINUTESPDFTEST where acdate = to_date('NOV','MON');
    (for both the query the output is same)
    TYPES ACDATE
    PINK 01-NOV-10
    but the table having following data:
    TYPES ACDATE
    PINK 14-NOV-10
    WHITE 15-NOV-10
    PINK 01-NOV-10
    Any suggestion why i could not get correct result.

    bharathit wrote:
    Thanks for toon and divya...it solved my problem and my question how will you select between two months..
    select types,acdate from ACMINUTESPDFTEST where to_char(acdate,'MON') >= 'SEP' AND to_char(acdate,'MON') <= 'OCT';
    and i got
    no rows selected
    Edited by: bharathit on Nov 2, 2010 10:37 PMIf you're interested in finding dates in a range of months regardless of the year then try this:
    select ...
    from   ...
    where  to_number(to_char(date_column,'MM')) Between 9 And 10;You could also do something like:
    select ...
    from   ...
    where  to_number(to_char(date_column,'MM')) In (1,4,7,10);If you are interested in dates in a range of months in a particular year however, use something like this:
    select ...
    from   ...
    where  date_column >= date '2010-09-01' and
           date_column < date '2010-11-01' and

  • How to Concatenate Table name and Where condition at runtime

    I am passing parameter as User and Zone to Stored Procedure.How to concatenate Table Name
    and WHERE CONDITION in SQL Statement.i have different type of users and zones.

    Hi !
    declare
      cur sys_refcursor;
      r emp%rowtype;
      v_sql varchar2(512);
    begin
    -- do your logic here
      v_sql := 'select * from emp';
      open cur for v_sql;
      loop
        fetch cur into r;
        exit when cur%notfound;
        dbms_output.put_line(r.ename);
      end loop;
      close cur;
    end;In this example you can see how can be done this with cursor vars .. You should concatenate v_sql string according to your requirements.
    But as in further posts has already been mentioned , be carefull at publishing such kind of procedures and think on security.
    Also when you want dynamicaly change from clause , you should consider using different records to accept data ? Maybe all your tables has the same structure and then this problem will be smaller.
    T
    T

  • How to use OMB to change filter conditions in OWB maps

    Hi,
    I want to know how we can use OMB to change filter conditions in an OWB map.
    As per my scenario i have a filter operator FLTR_1 in my maps and i have to change its filter condition from
    INOUTGRP1.ID IN (1,2)
    AND
    INOUTGRP1.VALUE > CONST_0_MAX_VAL
    to
    INOUTGRP1.ID IN (1,2)
    AND
    INOUTGRP1.VALUE > CONST_6_MAX_VAL
    Just for everybody's information we are migrating from OWB 9.2 to OWB 10.2 and we have called procedures in constants and used their values in filter conditions.OWB 10.2 generates the values for constants in a different way than OWB 9.2 thats why this change is required.I wish to automate the act of changing constant names so we can save time in changing the maps.
    Thx

    Carsten,
    I created a map in OWB 10.2 and ran the following command
    The filter operator name in this map is FILTER
    Carsten Herbe wrote:
    OMBALTER MAPPING 'TEST_MAP' MODIFY OPEARTOR 'FILTER' SET PROPERTIES (FILTER_CONDITION) VALUES ('INOUTGRP1.ID IN (1,2) AND INOUTGRP1.VALUE > CONST_6_MAX_VAL ')
    I got this error:
    OMB02933: Error getting child object of type OPEARTOR with name FILTER: MMM1034:
    Property OPEARTOR does not exist.
    Could you pls help on this.
    Thx

  • How to use multiple name-adresses pairs in Mail?

    Hello there,
    I had to format my machine due to a RAM glitch, and forgot how this was done.
    On the same email account, I want to use different names-addresses pairs (Alias), not just adresses (that is easy to do). I know it involves the edition of com.apple.mail.plist with a specialized editor (I started with Pref Setter, but it doesn't seem to be working properly as one item can't be renamed) since it is not in clear text anymore, but I can't succeed.
    Can anyone detail what is implied by this change?

    Thanks Abishek for your reply. 
    The problem is about passing 2 array list objects. 
    I have already done your proposal and the problem is you have both array list object with same value.
    My requirement is,
       I want to have ArrayList variables arrayList1  and arrayList2. Each will be populated with corresponding values based on the Rules fired.
    For. eg. Rule1 fires and adds "Value1" to arrayList1. Rule2 fires and adds "Value2" to arrayList2.
    I guess, this is not possible with default behaviour. Only Custom Helper Class can help.
    However I solved the problem in a different way. I created a schema which supports repeating nodes. Also I created a Helper class to Add Node to the document.
    <Test>
          <RepeatingNodes1><Node></Node><Node></Node>.......</RepeatingNodes1>
          <RepeatingNodes2><Node></Node><Node></Node>.......</RepeatingNodes2>
    </Test>
    Using the helper class, I add as many nodes possible.
    thanks

  • How to use P=name for Physical path name via t-cd:file

    Hello experts,
    I want to define physical path name using <P=name> for add-on programs.
    It is desirable to save files on another drive from SAP installed drive.
    I don't know which profile parameter can be changed.
    I'm afraid if standard logic wouldn't work when I change a parameter.
    I'm not sure, but DIR_TEMP doesn't seem to affect standard logic.
    What parameter should I use for add-on?
    Or can I create own profile parameter?
    Regards,
    Fukuhara Yohei

    In my detail block I have 10 rows displaying that may or may not have data after querying. To set the default value in the detail block, you have to set the index value of p_session.set_value. Since I don't know how many rows are already populated, I'm setting the default value to all 10 rows. Is there a better approach?
    Here's my code example, which I've placed in the additional PL/SQL section before displaying the form...
    DECLARE
    l_district_id VARCHAR2(7);
    BEGIN
    l_district_id := p_session.get_value_as_varchar2
    (p_block_name => 'MASTER_BLOCK',
    p_attribute_name => 'A_DISTRICT_ID');
    FOR i in 1 .. 10 LOOP
    p_session.set_value
    (p_block_name => 'DETAIL_BLOCK',
    p_attribute_name => 'A_DISTRICT_ID',
    p_value => TO_CHAR(l_district_id), p_index => i);
    END LOOP;
    END;

  • How to use more than one region 'Conditional Display'

    Hi,
    I use a region and i want to use 2 Conditional Display for this region:
    . Fisrt when 'Request Is Contained within Expression 1' ==> 'Val1,Val2'
    . Second when 'Inline Validation Errors Displayed'
    Is it possible.
    Thanks

    Hi,
    The first one is relatively straightforward as there is a Condition Type available for that.
    The second one is a bit more complicated but can still be done. Have a look at Re: how to use wwv_flow.g_inline_validation_error_cnt? This will tell you how many validations failed. If there were any failures, you can set a hidden page item to 1, for example, and then use this page item in your condition
    Andy

  • How to use %  Symbol for parameters in conditions in Discoverer

    Hi All,
    Actually I should add four parameters in that
    two param's should be given %(means to select all) as default value.
    ie as we use LIKE '%' in Query.
    the problem is when I enter a value for a parameter, it should result me for that particular value,
    and if I need all, I should enter % symbol,
    so for this Iam confused How to use this,
    even I tried with some options, it is not getting satisfactory results.
    will any one please help me in reaching this.
    Thank's in Advance
    Edited by: user10271105 on Sep 17, 2008 3:37 AM

    Hi,
    You can create a parameter and give % as the default value. If you set the condition to use LIKE then when the default value is used for the parameter then the query contains LIKE '%' and everything is selected.
    If you are using a List of Values with your parameter then you must add the '%' to your list of values so that the user can select this value.
    However, this method will not work if some of the values in your database contain percent characters, because the condition LIKE 'ABC%DEF' will return ABCXYZDEF as well as ABC%DEF.
    Unfortunately the like escape syntax is not available in Discoverer so you have to invent an value that the user can enter for all, e.g. ALL and set this as the default for the parameter.
    Then use a condition similar to:
    item LIKE :param OR item = DECODE(:param,'*ALL*', item)
    Rod West

  • How to use form name in struts html:form tag

    Hi,
    I want to validate text box value, if it is ordinary html form I would have done like this <form name="myform" action="xxxx.jsp" onsubmit="return validate()">
    But am using struts html:form tags. In this case how can I use/specify name for a form.
    Can any one help me.
    Thanks

    The name of the form comes from the actionForm you have defined backing it.
    View source on the generated page to see what HTML it constructs.
    You are able to use the onsubmit event with the <html:form> tag just like the standard one, so if all you want to do is that:
    <html:form action="/saveUser" onsubmit="return validate()">
    ...You can also give it a styleId, which will generate an id in the HTML.
    See the tag documentation for details: http://struts.apache.org/1.2.x/userGuide/struts-html.html#form

  • How to use table name dynamically in report  procedure

    Hello every body
    I want to use table name dynamically means at runtime i want to pass table name.
    I can do this by lexical parameter in main query.
    But my problem is that i want to crate new format trigger or new function that use 1 cursor in which that lexical parameter : table name is used.
    so how to do that?
    i can not use that lexical parameter it is giving error.
    please help me how to do that.

    Call a database function which you pass the lexical parameter. Then in the database function you use dynamic sql or the execute immediate option to build the SQL string.
    Return the information from this function to build your business logic on in your format trigger.
    Marcos

  • How to use technical names in ecatt's

    Hi All
    I am functional MM consultant, right now i am working on ecatts'.
    In ecatts in pattern tab in all commands in command there are various technical names.
    Now i want to use these technical names in ecatt's, how do i use them or where do i find the detail (how to use).
    Regards
    Hemant

    hi,
    There you can find the commands that u can use in eCATT editor for scripts development. Each command is meant for one particular use.
    I that we user TDC, SAPGUI,ABAP..ENDABAP.....and soon very often in ecatt scripts development.
    Go tru this link below for details,
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/3c333b40389c46e10000000a114084/content.htm
    And for more info
    Also see..
    /people/sapna.modi/blog/2006/04/10/ecatt--an-introduction-part-i
    /people/sapna.modi/blog/2006/04/10/ecatt-scripts-creation-150-tcd-mode-part-ii
    /people/sapna.modi/blog/2006/04/10/ecatt-scripts-creation--sapgui-mode-part-iii
    /people/sapna.modi/blog/2006/04/18/ecatt-logs-part-vi
    http://prasadbabu.blogspot.com
    >>reward if it helps.
    Cheers,
    kvr
    Message was edited by:
            PrasadBabu Koribilli

  • How to use a name="top" Hello I'm at the top /a tags in apex url ?

    I have a decode statement which creates link to different pages as below
    'f?p=107:1:&SESSION.::NO:::' and it works good.
    Now what I need to do is, I have 6 graphs in 6 different regions on a same page.
    so depending on the options I click, I need to reach to that particular graph using the anchor tags.
    Can you let me know how to do it in APEX ?
    Actually I dont know
    1. How to use these anchor tags in url's in APRX
    2. As well as how to put them on the same page at 6 different regions which I have created.
    Appreciate if someone can give me a good example for using it in apex.

    I have updated the region title with the anchor tags
    Now when I click on the link, it gets resolved to
    http://wsus01697353.am.adecco.net:7777/pls/apex/f?p=107:1:1063560330989286::DEBUG:::%23O2KP1
    instead of
    http://wsus01697353.am.adecco.net:7777/pls/apex/f?p=107:1:1063560330989286::DEBUG:::#O2KP1
    If i directly put in the above URL in the browser it works but when I try to get through the link it dose not work.
    Any suggestion ?

  • How to use Alias name in OData service in SAP HANA

    Hi,
         I need to change one column name with alias of another name in odata service definition or odata url running in rest client. I am trying to give alias name with as key in the service definition like sql query.
    ex:
    There is one table with column name of PRODUCT_ID. I exporting that table via odata service to SAP UI. In the UI i dont want the product id column as PRODUCT_ID. It should be ike "Prodcut". Like we are using in SQL example
    select "PRODUCT_ID" as "Product" from "producttab";
    But i can't use as key for alias name. So i am getting syntax error.
    I have tried in rest client also ie executing odata file in rest based service. But i got error only.
    If anyone knows about this alias name in odata service, Please help me to resolve this issue..

    Hi Thomas
         Thanks for your reply.
         Actually in odata service definition i am using attribute and calculation views only. But in some case from the model view itself i need to use some alias names to the UI through odata service.
         For example in attribute view i have some columns with name col1,col2... I am getting those columns in UI using  odata service, for particular col2 column i need to change column name as product. And i am using the same view as source of another odata service in that service i need to change that column name as productname.
         In that case i need alias name usage. So that only i am searching alias keyword in odata service.
         Is there any possibility to use alias names in odata service.

  • How to use Device Profiles and Viewing Conditions Profile in Photoshop Elements 11?

    In trying to get to grips with the Colour management aspects of PSE11, I have encountered the following problems:
    Having selected "Display" a sequence of clicks (Change display settings -> Advanced settings -> Colour Management -> Colour Management tab -> Colour Management)
    gives a screen which includes the headings:
    Device Profile  and Viewing Conditions Profile.
    1. Device Profile. Besides sRGB and ARGB, the profile list includes the profiles for all of the Epson papers. (I have an Epson Stylus Photo PX810FW).
    I changed the Profile to an Epson Grayscale, this was accepted within the menu, but there are no changes from normal when I viewed the image on the Windows screen or within
    PSE11. ("normal" is sRGB or ARGB).
    I thought it worth a try to test that, if I wanted the display image to closely represent what I would get on a particular Epson paper, this may be a way to do it.(I suspected this approach because I have never
    seen it in the literature!).
    So what is the purpose of all of the paper Profiles appearing in the Display listing?
    2. The Viewing Conditions Profile has also several options. I have tried to find the criteria for choosing one rather than the other, but failed to find any information. Can anyone help? I seek general guidance
    rather than the details of the Profiles.
    As a seperate question:
    Selecting Image on the PSE11 menu across the top of the displayed image, and then Convert Colour Profile, I tried this process on an image, converting tiff to sRGB. When saved there was an extra asterisk in the saved title but in this case,
    the file was still labelled tiff and there was no change in the number of Mbs. If a conversion has taken place, how is one to know?  Does saving a tiff file as jpeg change its colour profile? When is it useful to use this feature?
    Many thanks to all responders! 

    Addressing your second question, you are confusing two different things.
    tiff is an image file format, as is jpeg, as is psd, as is png, as are dozens (if not hundreds, http://en.wikipedia.org/wiki/Image_file_formats) of other formats.
    A colour profile represents the colour characteristics of devices so that, for example, displays know how to display the colours, printers know how to print them.
    Image files MAY, but do not have to, contain colour profiles.
    For details:
    http://help.adobe.com/en_US/creativesuite/cs/using/WS52323996-D045-437d-BD45-04955E987DFB. html
    http://en.wikipedia.org/wiki/Color_management#Color_profiles
    http://en.wikipedia.org/wiki/ICC_profile
    Cheers,
    Neale
    Insanity is hereditary, you get it from your children
    If this post or another user's post resolves the original issue, please mark the posts as correct and/or helpful accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

  • How to use column name as variable in select statement

    hi,
    i want to make a sql query where in select statement using variable as a column name. but its not working plz guide me how can i do this.
    select :m1 from table1;
    regards

    Hi,
    Is this what you want..
    SQL> select &m1 from dept;
    Enter value for m1: deptno
    old   1: select &m1 from dept
    new   1: select deptno from dept
        DEPTNO
            10
            20
            30
            40
    SQL> select &m1 from dept;
    Enter value for m1: dname
    old   1: select &m1 from dept
    new   1: select dname from dept
    DNAME
    ACCOUNTING
    RESEARCH
    SALES
    OPERATIONS
    SQL> select &&m1 from dept;
    Enter value for m1: loc
    old   1: select &&m1 from dept
    new   1: select loc from dept
    LOC
    NEW YORK
    DALLAS
    CHICAGO
    BOSTON
    SQL> select &&m1 from dept;
    old   1: select &&m1 from dept
    new   1: select loc from dept
    LOC
    NEW YORK
    DALLAS
    CHICAGO
    BOSTONIf you use single '&' then each time you fire the query, It will ask for the new value..
    But if you will use double '&&' the value of m1 will be persistent across the session..
    Twinkle

Maybe you are looking for

  • Dreamweaver MX create tables problem

    I am using Dreamweaver MX 6.0 and tried to create a table in standard view, but a sharing error message appeared and shut down the program.  When I opened again and tried to create the table again, the dialog window didn't even open after clicking on

  • Error when deploying BPM

    Hello, I'm trying to deploy a BPM that is using external web services, but get the following short dump when trying to deploy the application. I have checked that I have the same version of both the CE server and NWDS (7.3 sp 7). I have looked in the

  • IPod / iTunes Photo Synch

    Anyone have an answer to problem of iPod not synching with photos? Have some photos on iPod, added photos to my designated synch folder but they do not transfer when I update, even with appropriate boxes checked. I have plenty of space (GB's!). Thank

  • Transfer from ipad to laptop help please

    How do i get all my music and photos from ,my ipad to my laptop. My hard drive on my lap top  died and been replaced. I had backed up to iclouds on my ipad. How can i get everything back? If i sync it will wipe

  • Close tab buttons disappeared

    on safari the little x buttons used to close tabs has disappeared. how do I fix this?