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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:26:30+00:00 2026-05-12T07:26:30+00:00

I currently have a table(/grid) of data that I can page, filter and sort.

  • 0

I currently have a table(/grid) of data that I can page, filter and sort. On the table I also have a built in checkbox column. Paging, filtering and sorting right now happen within the SQL query. What I want to be able to do is sort by the clicked items in my checkbox column. This would bring all items that are checked to the front of the table. Since the checkboxes themselves are all client side I can’t just tell the SQL query to sort by a column that doesn’t exist (maybe I need to dynamically create one?)

In essence what I think would happen is that the checked boxes ID value would be sent into the query the the SQL query itself would somehow know to sort by that first and then by the others specified.

Something like, where 1, 2, and 3 are clicked:

SELECT * FROM Blah
ORDER BY (SELECT ID FROM Blah WHERE ID IN (1,2,3)), AnotherColumnToSort

That’s the plan anyway, anyone have any ideas on how to actually accomplish that?

Update: Smack I’m on an Oracle DB and not SQL Server like I had thought.

  • 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-05-12T07:26:30+00:00Added an answer on May 12, 2026 at 7:26 am

    Set a BIT field to 1 when the row is checked, 0 otherwise, then order by that field first:

    SELECT *
    FROM Blah
    ORDER BY Checked DESC, AnotherColumnToSort
    

    If you don’t want to (or can’t) store whether the row is checked in the table, derive it using a CASE clause:

    SELECT *
    FROM Blah
    ORDER BY
      CASE
        WHEN ID IN (1, 2, 3) THEN 1
        ELSE 0
      END DESC,
      AnotherColumnToSort
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a table with an id column that is being autoincremented and
I currently have a table structure that looks something like this(some details omitted): ColumnName
I currently have a table which only has a single editable column. I have
I'm trying to normalize a mysql database.... I currently have a table that contains
Currently we have a table that we use to track inivitations. We have an
I have a DataGridView in a form that has a data table as the
I currently have a table with 2 rows. Row 1 has and image and
I currently have a Table [org.eclipse.swt.widgets.Table] with several TableColumns; however, due to UI space
I currently have a table with a nested table in it: <table class=datagrid id=report>
I currently have a table called paper , which holds all the information for

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.