Duplication

Last post 10-29-2007 3:29 AM by anandchatterjee. 3 replies.
Page 1 of 1 (4 items)
Active Topics My Discussions Unanswered Sort Posts: Previous Next
  • 10-29-2007 1:21 AM

    • Jeena
    • Top 500 Contributor
    • Joined on 10-17-2007
    • India
    • Posts 30

    Duplication

    Hi all,

    Im having problem and im spending half of the time for this. I have a databse for sms chat service. and a table containing the details such as mobileno,message,language,place,category,date,year.In this table i have a huge number of records. Now the problem is that i need to sort my table. I need the result in the same format(mobileno,message,language,...).And no duplication for mobileno.

    Same mobileno will send more than one message.But i need only unique mobileno.In this situtaion what query can i give. I tried with some select query but all are giving the duplication of mobileno.

    Pls help if anyone knows abt this.

    Thanks in advance.

    Jeen

    Filed under:
  • 10-29-2007 1:54 AM In reply to

    Re: Duplication

    Do you need the latest message from that mobile number? Unless it will return the multiple messages.. Please explain your query once again!

  • 10-29-2007 3:03 AM In reply to

    • Jeena
    • Top 500 Contributor
    • Joined on 10-17-2007
    • India
    • Posts 30

    Re: Duplication

    Hi,

    I need only unique mobileno. and other detail can be of old or new.That doesnt matter.But only one message from that mobileno.All the other details should be once.

  • 10-29-2007 3:29 AM In reply to

    Re: Duplication

    If your datefield is storing datetime then try this one..

    create table testNum
    (
    val numeric,
    msg char(10),
    Dt datetime
    )
    go
    insert into testNum values (111,'aaa',getdate())
    go
    insert into testNum values (111,'bbb',getdate())
    go
    insert into testNum values (121,'ddd',getdate())
    go
    insert into testNum values (122,'eee',getdate())
    go

    select a.val as MobileNo, max(a.dt) as 'date',(select b.msg from testNum b where b.dt= max(a.dt)) as 'Date' from testNum a
    group by val

    select * from testNum

Page 1 of 1 (4 items)
Active Topics   My Discussions    Unanswered Posts


© 2000 - 2007 vDerivatives Limited All Rights Reserved.