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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:18:31+00:00 2026-06-04T16:18:31+00:00

I have a field in my database that has 5 possible values: fair, good,

  • 0

I have a field in my database that has 5 possible values: fair, good, very good, ideal, siganture ideal

I have a coldfusion form that has 2 drop-downs each with all the values. What I am looking to do is be able to have the user select a range. For example dropdown1 = Fair dropdown2 = Very Good. So this would somehow generate the SQL WHERE statement:

grade IN (‘fair’, ‘good’, ‘very good’)

Can you think of a smart way to program this given that the values have to be this way. I think maybe if I put them in an array and then looped through it or something. I’m a little stumped on this any help would be appreciated.

  • 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-04T16:18:33+00:00Added an answer on June 4, 2026 at 4:18 pm

    As others mentioned, redesigning is ultimately the better course of action, both in terms of efficiency and data integrity. However, if you absolutely cannot change the structure, a possible workaround is to create a lookup table of the allowable grade descriptions, along with a numeric rating value for each one:

     GradeID | GradeText        | Rating
     1       | Fair             | 0
     2       | Good             | 1
     3       | Very Good        | 2
     4       | Ideal            | 3
     5       | Signature Ideal  | 4
    

    Then populate your select list from a query on the lookup table. Be sure to ORDER BY Rating ASC and use the rating number as the list value. Then on your action page, use the selected values to filter by range. (Obviously validate the selected range is valid as well)

      SELECT  t.ColumnName1, t.ColumnName2
      FROM    SomeTable t INNER JOIN YourLookupTable lt ON lt.Grade = t.GradeText
      WHERE   lt.Rating BETWEEN <cfqueryparam value="#form.dropdown1#" cfsqltype="cf_sql_integer">
              AND <cfqueryparam value="#form.dropdown2#" cfsqltype="cf_sql_integer">
    

    Again, I would recommend restructuring instead. However, the above should work if that is really not an option.

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

Sidebar

Related Questions

I have a SQL database that has a table with a field set to
I have a field in my database that contain comma separated values these values
I have a form that has all the fields pulled dynamic from a database
I have a column that has an ImageButton. my database field has bit data
I have a table in my database which is house, that has many field
In rails 3, I have a database model that has a birthday field, of
OK, so I have a database field of type char(1) that has a small
I have a distance field in my database that stores the distance traveled on
say i have a nvarchar field in my database that looks like this 1,
I have a combobox that is filled with data field JobCode from database. There

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.