Loading ...
Sorry, an error occurred while loading the content.

3003Re: SQL If statement????

Expand Messages
  • sjcwhittle
    Aug 1, 2007
      Hi - Thankyou for the help

      basically I have a query that is looking for say X in table 1.

      If X is in table one, all is good. If it is not, I want the query to
      populate a Y. Is this possible?








      --- In SQLQueriesNoCode@yahoogroups.com, srussell@... wrote:
      >
      > > hi,
      > >
      > > This is what I understand from your point. If I mis-understand
      or my point
      > > is not very clear then let me know and clarify your case with
      the
      > > example:
      > >
      > > I think you wanna result set; if Table A does not contain the
      reference
      > > then
      > > you want it to replace it with some other field.
      > >
      > > Now you can check it with the count of the result set and if
      count is zero
      > > then you can return the default values and if count is 1 or
      greater then
      > > you
      > > can return the actual values.
      >
      >
      >
      > Try either CASE or ISNULL for T-SQL substitutions as needed.
      >
    • Show all 9 messages in this topic