Inner join with where

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

    Inner join with where

    I have the following SQL statement I need to
    add a secondary where clause to

    SELECT name, amount
    FROM node, log
    WHERE log.name (+) = node.name

    Now I need to add run_date = '31-JAN-05',
    I can not just add this statement since when I do
    loose columns in the node table since there is
    not a 1:1 match between the two tables.

    --
  • Mark C. Stock

    #2
    Re: Inner join with where


    "Nerfherder " <nobody@home.co mwrote in message
    news:33gd015g73 geljerllut1hmer 5uruv05rv@4ax.c om...
    >I have the following SQL statement I need to
    add a secondary where clause to
    >
    SELECT name, amount
    FROM node, log
    WHERE log.name (+) = node.name
    >
    Now I need to add run_date = '31-JAN-05',
    I can not just add this statement since when I do
    loose columns in the node table since there is
    not a 1:1 match between the two tables.
    >
    >
    which table is the run_date column in?

    bottom line, you have to include the oracle's outer join syntax in all
    affected predicates, so, depending on which table RUN_DATE is in, you need
    to add either

    run_date = to_date('31-JAN-05','dd-mon-rr') (+)

    or

    run_date(+) = to_date('31-JAN-05','dd-mon-rr')


    note also that you should never use implicite date conversion -- either use
    TO_CHAR or the ansi date literal syntax (if using 10g)

    ++ mcs


    Comment

    • Nerfherder

      #3
      Re: Inner join with where

      "Mark C. Stock" <mcstockX@Xenqu ery .comsaid:

      Thanks, that worked.
      >to_date('31-JAN-05','dd-mon-rr')

      Comment

      Working...