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. query of select max number

query of select max number

Scheduled Pinned Locked Moved Database
database
6 Posts 3 Posters 1 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.
  • M Offline
    M Offline
    Mohammad Dabaan
    wrote on last edited by
    #1

    Hi, i have a DB table which has just only one column, i have an integer column field in it, i want to know the query for retriving not the highes number (i mean as select max of the column) i want the select the number comes before the max number, ;)

    Thanks alot Hamody

    J 1 Reply Last reply
    0
    • M Mohammad Dabaan

      Hi, i have a DB table which has just only one column, i have an integer column field in it, i want to know the query for retriving not the highes number (i mean as select max of the column) i want the select the number comes before the max number, ;)

      Thanks alot Hamody

      J Offline
      J Offline
      japel
      wrote on last edited by
      #2

      Here you go... SELECT Max(myIDColumn) FROM myTable This will return the highest number in a column from a table.

      When people make you see red, be thankful your not colour blind.

      M 1 Reply Last reply
      0
      • J japel

        Here you go... SELECT Max(myIDColumn) FROM myTable This will return the highest number in a column from a table.

        When people make you see red, be thankful your not colour blind.

        M Offline
        M Offline
        Mohammad Dabaan
        wrote on last edited by
        #3

        hello, thanks i know that SELECT Max(myIDColumn) FROM myTable will return the highest or max number, i want to get the number comes before the max number not the max itself :((

        Thanks alot Hamody

        J 1 Reply Last reply
        0
        • M Mohammad Dabaan

          hello, thanks i know that SELECT Max(myIDColumn) FROM myTable will return the highest or max number, i want to get the number comes before the max number not the max itself :((

          Thanks alot Hamody

          J Offline
          J Offline
          japel
          wrote on last edited by
          #4

          Sorry didn't read you post very well. SELECT Max(myIDColumn - 1) FROM myTable

          When people make you see red, be thankful your not colour blind.

          M 1 Reply Last reply
          0
          • J japel

            Sorry didn't read you post very well. SELECT Max(myIDColumn - 1) FROM myTable

            When people make you see red, be thankful your not colour blind.

            M Offline
            M Offline
            Mohammad Dabaan
            wrote on last edited by
            #5

            thanks a lot there, merci beacoup :rose:

            Thanks alot Hamody

            A 1 Reply Last reply
            0
            • M Mohammad Dabaan

              thanks a lot there, merci beacoup :rose:

              Thanks alot Hamody

              A Offline
              A Offline
              Arun Immanuel
              wrote on last edited by
              #6

              I think this will work if the number u require is always 1 less than the max number. Here is the command for the column which have random values. select max(colName) From tblName where colName not in( select Max(colName)From tblName) Regards, Arun Kumar.A

              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