IF funcionality in SQL server views

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • the_raj

    IF funcionality in SQL server views

    Hi,

    I am working with several tables and views. My goal is to create a view
    with critical reporting data from these tables and views. I have
    managed to get the majority of data but am having difficultly with the
    final step.

    For a record in the master dataview, add additional record information
    by appending data from another view based on the first 2 letters of the
    document number and the document number i.e

    Document number
    SC11111
    DN22222
    SI33333

    For SC11111 look up data in Sales Credit table/view for doument SC11111
    and append to that line
    For DN22222 look up data in Delivery Note table/view for document
    DN22222and append to that line
    For SI33333 look up data in Sales Invoice table/view for document
    SI33333 and append to that line

    Any help appreciated.

    Thank you in advance,

    Raj

  • Will

    #2
    Re: IF funcionality in SQL server views

    Can I just clarify what you're trying to do...

    as I understand it, you want to select from different tables/views
    depending on what the data is.

    if so, could you left join on all 3 tables, then using join filters and
    using isnull() in your select you could just get the data from the
    relevant table.

    Otherwise, could you explain a bit further what the problem is.

    Cheers
    Will

    Comment

    Working...