distinct use

  • Hi!...

    I need to narrow down result of a consult with distinct sentence.

    But i need to do it to two rows. I cant seem to get it right.

    select distinct scodaux,ingnlabo

    from dbo.ingmuestra

    I need unique values in scodaux and ingnlabo.

    thanks in advance.

  • Here's a simple distinct example..

    create table x

    (

    x1 integer,

    x2 integer

    )

    go

    insert into x

    select 1,0

    union all

    select 1,0

    go

    select * from x

    go

    select distinct x1,x2 from x

    Im not sure im clear on your requirements , can you provide sample input data and your expected output ?



    Clear Sky SQL
    My Blog[/url]

  • Dave Ballantyne (9/7/2009)


    Here's a simple distinct example..

    create table x

    (

    x1 integer,

    x2 integer

    )

    go

    insert into x

    select 1,0

    union all

    select 1,0

    go

    select * from x

    go

    select distinct x1,x2 from x

    Im not sure im clear on your requirements , can you provide sample input data and your expected output ?

    thanks!

    This is a part of the table. I need to select de unique numbers of 3 and get the linked numbers on 1 in the same select.

    1 2 3

    10480396689340

    11511780914400

    12433296773290

    13294496773290

    14532996711590

    15528096828810

    16528096828810

    17478576741450

    18478576741450

    19478576741450

    20511388680500

    21511388680500

    22511388680500

  • OK....

    Take For instance

    1 2 3

    -----------------

    15 5280 96828810

    16 5280 96828810

    What output are you expecting

    96828810 15,16

    96828810 15

    96828810 16

    something else?



    Clear Sky SQL
    My Blog[/url]

  • Dave Ballantyne (9/7/2009)


    OK....

    Take For instance

    1 2 3

    -----------------

    15 5280 96828810

    16 5280 96828810

    What output are you expecting

    96828810 15,16

    96828810 15

    96828810 16

    something else?

    ok... im expecting

    96828810 15,16

  • This link discusses your options

    http://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/

    Feel free to post again with any further questions



    Clear Sky SQL
    My Blog[/url]

  • Dave Ballantyne (9/7/2009)


    This link discusses your options

    http://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/

    Feel free to post again with any further questions

    thanks.

    i will read it.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply