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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Sqlite (Max Value)

Sqlite (Max Value)

Scheduled Pinned Locked Moved Database
databasesqlitequestion
6 Posts 4 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.
  • J Offline
    J Offline
    jashimu
    wrote on last edited by
    #1

    Hi all, I am trying to get the largest number from a column. where it happend to be the same number exist multiple times. But I am only interested only one number that is largest. do not care how many are there. thanks FYI database sqlite3. Second question: How come variable type datetime does not work in sqlite. I am using now as string data type but I need to use as datetime where I can query as datetime. thanks again.

    L 1 Reply Last reply
    0
    • J jashimu

      Hi all, I am trying to get the largest number from a column. where it happend to be the same number exist multiple times. But I am only interested only one number that is largest. do not care how many are there. thanks FYI database sqlite3. Second question: How come variable type datetime does not work in sqlite. I am using now as string data type but I need to use as datetime where I can query as datetime. thanks again.

      L Offline
      L Offline
      loyal ginger
      wrote on last edited by
      #2

      select max([your field name]) from [your table]; That returns the max number of that column. There is no DateTime type in SQLite. You can use text type for it. SQLite has a few date/time functions you can use, though. Use ANSI format for the datetime field. It will sort the field correctly.

      J M 3 Replies Last reply
      0
      • L loyal ginger

        select max([your field name]) from [your table]; That returns the max number of that column. There is no DateTime type in SQLite. You can use text type for it. SQLite has a few date/time functions you can use, though. Use ANSI format for the datetime field. It will sort the field correctly.

        J Offline
        J Offline
        jashimu
        wrote on last edited by
        #3

        Thanks for your reply. I will let you know if were able to solve my problems. thanks again.

        1 Reply Last reply
        0
        • L loyal ginger

          select max([your field name]) from [your table]; That returns the max number of that column. There is no DateTime type in SQLite. You can use text type for it. SQLite has a few date/time functions you can use, though. Use ANSI format for the datetime field. It will sort the field correctly.

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

          Loyal ginger, thanks for your help it works. Just to let you know that I am very new to database. thanks

          D 1 Reply Last reply
          0
          • J jashimu

            Loyal ginger, thanks for your help it works. Just to let you know that I am very new to database. thanks

            D Offline
            D Offline
            dan sh
            wrote on last edited by
            #5

            So why not vote the reply as good answer.

            50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

            1 Reply Last reply
            0
            • L loyal ginger

              select max([your field name]) from [your table]; That returns the max number of that column. There is no DateTime type in SQLite. You can use text type for it. SQLite has a few date/time functions you can use, though. Use ANSI format for the datetime field. It will sort the field correctly.

              M Offline
              M Offline
              Mycroft Holmes
              wrote on last edited by
              #6

              loyal ginger wrote:

              There is no DateTime type in SQLite

              I find that incredible considering all the problems that arise from storing date values as strings.

              Never underestimate the power of human stupidity RAH

              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