sequential - Sequentially number rows by keyed group in SQL? -


Is there a way to add a key number in the SQL key group ?

Arbitrary (code, NAME) Suppose a table with tuples Example table:

  Code name ---- ---- A Apple a Angel A Arizona B Bravo C. Charlie C Cat de Dog de Doppler D Data D Below   

The desired projection to use CODE as grouping attribute:

  code C_NO NAME -------- ---- A1 Apple A1 Angel A2 Arizona B B Bravo C 1 Charlie C. Cat D. Dog D1 Data D2 Down D3 Doppler   

thanks

  • Li>
  • MySQL does not do AFAIK. The most included in the base.

      Selection code, ROW_NUMBER () (name by order by order) - 1 as C_NO, name from MyTable   < / Div> 

  • Comments

    Popular posts from this blog

    qt - switch/case statement in C++ with a QString type -

    python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

    Python's equivalent for Ruby's define_method? -