Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9320295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:36:01+00:00 2026-06-19T03:36:01+00:00

I have a table on a remote server that stores version numbers for our

  • 0

I have a table on a remote server that stores version numbers for our client side software. I use SOAP to handle requests. The client software sends a version number and I need to use SQL to find the next version numbers.

Here’s the SQL that I use. I’m having a bit of a bad brain day, and I know this isn’t correct but I can’t seem to figure out what I need to do.

The create table code:

CREATE TABLE IF NOT EXISTS `sqlUpdateVersions` (
  `primary_key` int(11) NOT NULL AUTO_INCREMENT,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `comment` text NOT NULL,
  `majorVS` tinyint(4) NOT NULL,
  `minorVS` tinyint(4) NOT NULL,
  `revisionVS` tinyint(4) NOT NULL,
  `buildVS` tinyint(4) NOT NULL,
  `filePK` int(11) NOT NULL,
  `customDBJarPK` int(11) DEFAULT NULL,
  PRIMARY KEY (`primary_key`),
  KEY `filePK` (`filePK`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

This is the SQL query to find a version #. I dumped in this version 1.1.0.0

select b.majorVS, b.minorVS,b.revisionVS, b.buildVS
 from sqlUpdateVersions b  where
 b.majorVS>=1 AND b.minorVS >=1 AND b.revisionVS>=0 AND b.buildVS>=10 
 ORDER BY b.majorVS,b.minorVS,b.revisionVS, b.buildVS

Now clearly I can tell this SQL is problematic. But how would I structure one that would return the next values, say 1.2.0.0 or 1.1.1.0

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T03:36:03+00:00Added an answer on June 19, 2026 at 3:36 am

    Here is a brute force approach:

    select suv.*
    from sqlUpdateVersions suv
    where suv.majorVS > 1 or
          (suv.MajorVs = 1 and suv.minorVS > 1) or
          (suv.MajorVS = 1 and suv.minorVS = 1 and suv.revisionVS > 0) or
          (suv.MajorVS = 1 and suv.minorVS = 1 and suv.revisionVS = 0 and suv.buildVS > 10)
    order by suv.MajorVS, suv.MinorVS, suv.revisionVS, suv.buildVS
    

    You can also convert the versions to a bigint and do the comparison directly:

    select suv.*
    from (select suv.*,
                 buildVS + (cast(1000 as bigint)*revisionVS +
                            (cast(1000 as bigint)*minorVS +
                             (cast(1000 as bigint)*majorVS
                             )
                            )
                           ) as bigVersion 
          from sqlUpdateVersions suv
         ) suv
     where bigversion > 1001000010
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a remote mySQL table that I use in a few tools, occasionally
My main storage is MySQL, but I have to use remote MSSQL Server, where
I have a occasionally connected application where there is a server that stores information
I have a large table on a remote server and want to keep a
I have table with around 70 000 rows. There is 6000 rows that i
I have table of data that is sorted as follows: Item | Sample |
I have an ASP.NET MVC 3 app that is using SQL Server CE 4.0
Short Version I have a list of int s that I need to figure
I'm helping implement a SQL Server 2008 database and I have several columns that
I have a stored procedure that uses a table valued function which executes in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.