Results 1 to 3 of 3

Thread: Clustering data

  1. #1
    Join Date
    Feb 2004

    Unanswered: Clustering data

    Hi ,
    i have a table with 4 columns.
    Col1 Col2 Col3 Col4
    1 a1 b1 c1
    1 a2 b2 c2
    2 a3 b3 c3
    2 a4 b4 c4
    2 a5 b5 c5
    3 a6 b6 c6
    4 a6 b7 c7
    I need to have one more column in my O/P with group no(Seq no)


    Col1 Col2 Col3 Col4 group
    1 a1 b1 c1 1
    1 a2 b2 c2 1
    2 a3 b3 c3 1
    2 a4 b4 c4 1
    2 a5 b5 c1 1
    3 a6 b6 c6 2
    4 a6 b7 c7 2

    For First two rows Col1 is equal and they belong to group 1.
    But Fifth row also belongs to group 1 as col4 is equal to col4 of row1
    But third,fourth,fifth rows become a group by col1,But row 5 is in group 1 so all first five rows now belong to a single group.i need to check for all columns
    How do i implement this.i have no clue in doing it.


  2. #2
    Join Date
    Jul 2003
    Quote Originally Posted by madala99
    Hi ,
    PHP Code:

    Col1  Col2  Col3  Col4       group       
     1       a1    b1    c1         1
     1       a2    b2    c2         1
     2       a3    b3    c3         1
     2       a4    b4    c4         1
     2       a5    b5    c1         1
     3       a6    b6    c6         2 
     4       a6    b7    c7         2 
    wow, tricky

    Would this be true?
    Since row5 col4 = row1 col4, then ALL below it must be in same group regardless
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Feb 2004


    yup thats true
    they both should be in one group

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts