Results 1 to 3 of 3

Thread: SQL 2005 If Statement some help please

  1. #1
    Join Date
    Feb 2008
    Posts
    3

    SQL 2005 If Statement some help please

    I'm new to SQL 2005 and would greatly appreciate some help in the following problem.

    I have two tables joint by the ID field
    In table one I have the following fields Sequence, Quan and ID.
    In table two I have Quan and ID

    Here is what I would like if possible.

    If Sequence is = Null then show me the Quan value from table 2 else show me the Quan value from table 1.
    Last edited by chapo; 02-27-2008 at 08:04 PM.

  2. #2
    Join Date
    Dec 2004
    Posts
    502
    SELECT
    CASE WHEN Table1.Sequence IS NULL THEN Table2.Quan
    ELSE Table1.Quan END
    FROM Table1 JOIN Table2
    ON Table1.ID = Table2.ID

  3. #3
    Join Date
    Feb 2008
    Posts
    3
    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •