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 1003233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:56:55+00:00 2026-05-16T07:56:55+00:00

Assuming a wagetable: name lowhours highhours wage Default 0.0 40.0 100 Default 40.0 50.0

  • 0

Assuming a wagetable:

name     lowhours  highhours  wage 
 Default  0.0       40.0       100  
 Default  40.0      50.0       150  
 Default  50.0      70.5       154  
 Default  70.5      100.0      200  
 Brian    0.0       40.0       200  
 Brian    40.0      50.0       250  
 Brian    50.0      60.0       275  
 Brian    60.0      70.0       300  
 Brian    70.0      80.0       325  
 Brian    80.0      9999.0     350  
 Chad     0.0       40.0       130  
 Chad     40.0      9999.0     170 

I am currently using this code (AutoIT scripting:

func getCurrentWage($Employee, $Hour_number)
    Dim  $row
    Local $Wage = 0
    Local $Found = "found"
    _SQLite_QuerySingleRow(-1, "SELECT wage FROM wagetable WHERE name LIKE " & _SQLite_Escape($Employee) & " AND " & _SQLite_Escape($Hour_number) & " BETWEEN lowhours AND highhours;", $row)
    if @error then
        _SQLite_QuerySingleRow(-1, "SELECT wage FROM wagetable WHERE name LIKE 'Default' AND " & _SQLite_Escape($Hour_number) & " BETWEEN lowhours AND highhours;", $row)
        $Found = "not found"
    endif

    If ($row[0] == "") Then Msgbox(0,0,"Error getCurrentWage")
    $Wage = $row[0]

    Debug("Wage='" & $Wage & "'  because " &$Employee&" was "& $Found& " -- and Hours Elapsed is " & $Hour_number, true)
    return $Wage
EndFunc

So those 2 queries are perfect if the Hour_number is inbetween a low hour or a high hours.
I need some sort of query where it will basically do something like:

SELECT wage from wagetable WHERE name LIKE $Employee AND max(highhours)

and then just repeat it for ‘Default’ is the employee is not found.

Extra: Is it possible to try the ‘Default’ if $Employee is not found with just 1 query?

  • 1 1 Answer
  • 1 View
  • 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-05-16T07:56:55+00:00Added an answer on May 16, 2026 at 7:56 am

    Is it possible to try the ‘Default’ if $Employee is not found with just 1 query?

      SELECT name, wage, highhours
        FROM wagetable
       WHERE name like 'Brian' OR
             name like 'Default'
    ORDER BY name,
             highhours desc
    

    This query works when querying for Brian, but for it to work for any name the Default should be stored in your database starting with a special character _-+@, because numbers and letters come first in sorting.

    Another way would be for you to create another column to the table, for the sake of our argument, called priority which should have the value 0 for Default and 1 for any other user. Then you could simply do:

      SELECT name, wage, highhours
        FROM wagetable
       WHERE name like 'Brian' OR
             name like 'Default'
    ORDER BY priority desc,
             highhours desc
    

    Of course it is the same solution, but it is a better approach, than relying on a special character in the name of the default values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming that we have a T myarray[100] with T = int, unsigned int, long
Assuming I have a table with one field called ID that stores 100 different
Assuming the following JSON structure: { \is_something\: false, \name\: \Some Name\, \subtype\: { \total\:
Assuming I have only the class name of a generic as a string in
assuming below table; column name | type id | int date | varchar When
This is continuing questions from Selecting the highest salary Assuming a table ' wagetable
Assuming I can telnet to gitorious.org port 9418 (default for git), but not on
Assuming I have a numerical string: var foo = 0; Assume I want to
Assuming that I have this: enum { A = 0x2E, B = 0x23, C
Assuming all my Gradle plugin user going to have a MYAPP_HOME sys variable set

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.