Book a Demo

Author Topic: Problem with parsing double elements  (Read 2488 times)

utilisateurEA

  • EA User
  • **
  • Posts: 57
  • Karma: +0/-0
    • View Profile
Problem with parsing double elements
« on: June 22, 2010, 06:47:09 pm »
Hello,
I'd like to have a list of all "double" elements. I mean elements with the same name and the same type  (they should not exist, that's why I want to have a list to correct mistakes).

I have written this kind of code, but the result giving how many times an element appear is totally wrong, and I wonder if elements printed are really "double".
Could you give me your opinion about how I search them :

(at the beginning I have stored a list of the elements in Elem_in_table)
Code: [Select]
while (index_elem1 < numberOfElements) // we parse all the elements
{
  short i_element2 = 0;
  while (i_element2 < numberOfElements)
  {
     if (index_elem1 != index_elem2) // the parsing method could give several time the same element. We exclude this case.
     {
       if (Elem_in_table[index_elem1].Name.Equals(Elem_in_table [index_elem2].Name)) // 2 elements of the list has the same name
       {
          if (Elem_in_table [index_elem1].Type.Equals(Elem_in_table [index_elem2].Type)) // 2 elemnts has the same name AND the same type
          {
            (tab_nb_of_doubles[index_elem1])++;
          }
       }
     }
     index_elem2++;
  }
  index_elem1++;
}


beginner

  • Guest
Re: Problem with parsing double elements
« Reply #1 on: June 22, 2010, 07:23:17 pm »
Try this:
Code: [Select]
SELECT name, count(name), object_type  FROM t_object group by name order by count(name) desc
b.