remove double value

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

    remove double value

    Hy
    Never use/practice SQL a lot, (vb... more, have free msde 2000) .
    2 questions
    A)is it simple to write a T-SQL query for having 2) at result starting
    from 1) .
    B)how to test dynamically sql with parmaeter ( using vb ADO)

    1) before query
    columA columB
    d e <-same
    e d <-same
    e e
    e d <-same

    2)after query
    columA columB
    d e or e d
    e e
  • David Portas

    #2
    Re: remove double value

    > A)is it simple to write a T-SQL query for having 2) at result starting[color=blue]
    > from 1) .[/color]

    SELECT DISTINCT
    COALESCE(S2.a,S 1.a) AS a,
    COALESCE(S2.b,S 1.b) AS b
    FROM Sometable AS S1
    LEFT JOIN Sometable AS S2
    ON S1.a = S2.b AND S1.b = S2.a AND S2.a < S2.b
    [color=blue]
    > B)how to test dynamically sql with parmaeter ( using vb ADO)[/color]

    This may help:
    Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.

    See also:


    --
    David Portas
    ------------
    Please reply only to the newsgroup
    --


    Comment

    • lionel

      #3
      Re: remove double value

      David Portas wrote:[color=blue][color=green]
      >>A)is it simple to write a T-SQL query for having 2) at result starting
      >>from 1) .[/color]
      >
      >
      > SELECT DISTINCT
      > COALESCE(S2.a,S 1.a) AS a,
      > COALESCE(S2.b,S 1.b) AS b
      > FROM Sometable AS S1
      > LEFT JOIN Sometable AS S2
      > ON S1.a = S2.b AND S1.b = S2.a AND S2.a < S2.b
      >
      >[color=green]
      >>B)how to test dynamically sql with parmaeter ( using vb ADO)[/color]
      >
      >
      > This may help:
      > http://msdn.microsoft.com/library/en...prg02_6df7.asp
      > See also:
      > http://www.sommarskog.se/dyn-search.html
      >[/color]

      hy
      thank a lot for sharing your knowledge.
      perhaps it was easy for you buit very hard for me
      thank's for your quicky response

      Comment

      Working...