NULL or no values in OUTER JOINS

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Re: NULL or no values in OUTER JOINS

    Here it is, finally. Phil, thanks for your help - you were instrumental in
    getting my thinking along the right lines.

    SELECT X.*,
    tbl_month.ID AS monthID, tbl_month.month_name, tbl_month.fy_order,
    tbl_school_year.ID AS syID, tbl_school_year.school_year,
    tbl_adult.ID AS adID, tbl_adult.assigned_ID, tbl_adult.last_name,
    tbl_adult.first_name, tbl_adult.middle_initial, tbl_adult.ssn,
    tbl_adult.family_ID AS famID

    FROM
    (SELECT * FROM tbl_part_adult
    WHERE year_ID = <CFQUERYPARAM VALUE="#form.year_ID#"
    CFSQLTYPE="CF_SQL_INTEGER">
    AND adult_ID = <CFQUERYPARAM VALUE="#form.part_ID#"
    CFSQLTYPE="CF_SQL_INTEGER">) as X
    RIGHT OUTER JOIN tbl_month ON tbl_month.ID = X.month_ID
    LEFT OUTER JOIN tbl_school_year ON tbl_school_year.ID = X.year_ID
    LEFT OUTER JOIN tbl_adult ON tbl_adult.ID = X.adult_ID

    ORDER BY fy_order

    The subquery with the two WHERE clauses must be processed first, so that it
    can be outer joined. When I was trying to limit the result set before, with
    the WHERE clauses at the end, it was eliminating the open results I wanted from
    the nested outer joins to zero or one, depending on how I phrased it. The
    lesson for me is that while ANSI-92 is certainly more capable and precise, it
    is also very particular about syntax and the order of phrasing in the query,
    which I've never had an issue with in T-SQL.

    Captain Special Guest

  2. Similar Questions and Discussions

    1. Please HELP! Problem with NULL values...
      Hey everyone! I'm developing an asp/VBScrpti/Access web site and I'm having a little trouble with the record sets SQL. The site's deadline is...
    2. Null Values
      hi how to count null values in an array? tnx
    3. Pinning buffers for long times like outer joins might do.
      Hi, I am writing an algorithm in a dynamic c library and using heap_fetch. I want to pin strategic buffers for long times like an Outer joins...
    4. Apparently I don't understand full outer joins....
      I run this: select coalesce(a.n,0) as a, coalesce(b.n,0) as b, coalesce(a.s,b.s) as s from ( select 1 as n, 0 as s) a full outer join (...
    5. Outer Glow: Best way to achieve correct, fast, memory-saving Outer Glow
      My problem is the following. I'm working on rather large panels (55cm/~20" wide). The outer glow arrow a title has to have a radius of about 8 pt...
  3. #2

    Default Re: NULL or no values in OUTER JOINS

    Excellent! Glad that you were able to finally get the results that you were
    after. I know, after writing queries in Oracle for years, I am still adjusting
    to the ANSI-92 SQL syntax and all of its implications. (Just be thankful that
    you aren't using an Access database. It is real particular about needing to
    place parentheses in the joins, at least with Access 97.)

    Phil

    paross1 Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139