> SELECT  id, code FROM a WHERE
>     (code IN
>         (SELECT code FROM
>                 (SELECT code, COUNT(code) AS c FROM  a GROUP BY code) AS aaa 
> WHERE  c > 1)
>         )
>    and ORDER BY code

The "and" in your code is illegal, but it is better to use

  select id, code from a
  where code in
    (select code from a group by code having count(code) > 1)
  order by code

Regards

Reply via email to