Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. ERROR

ERROR

Scheduled Pinned Locked Moved Database
helpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kibromg
    wrote on last edited by
    #1

    Hi all, Select distinct(Mobile), ROW_NUMBER() OVER(PARTITION BY mobile ORDER BY dateofcall DESC ) AS 'RowNumber' from Call having RowNumber=1 Error Invalid coulmn RowNumber Can any one advice please? Thank you

    L 1 Reply Last reply
    0
    • K kibromg

      Hi all, Select distinct(Mobile), ROW_NUMBER() OVER(PARTITION BY mobile ORDER BY dateofcall DESC ) AS 'RowNumber' from Call having RowNumber=1 Error Invalid coulmn RowNumber Can any one advice please? Thank you

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      The columname-alias "RowNumber" can only be used in a ORDER BY clause. Try this one;

      SELECT TOP 1
      distinct(Mobile), ROW_NUMBER() OVER(PARTITION BY mobile ORDER BY dateofcall DESC ) AS 'RowNumber' from Call

      I are troll :)

      K 1 Reply Last reply
      0
      • L Lost User

        The columname-alias "RowNumber" can only be used in a ORDER BY clause. Try this one;

        SELECT TOP 1
        distinct(Mobile), ROW_NUMBER() OVER(PARTITION BY mobile ORDER BY dateofcall DESC ) AS 'RowNumber' from Call

        I are troll :)

        K Offline
        K Offline
        kibromg
        wrote on last edited by
        #3

        top 1 returns one record.what i want is to select only those that has a first entry to my database.RowNumber=1

        L 1 Reply Last reply
        0
        • K kibromg

          top 1 returns one record.what i want is to select only those that has a first entry to my database.RowNumber=1

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You can change the sorting by changing the ORDER BY clause, so that the first row is the first entry :)

          I are troll :)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups