Forum Discussion

AmedMesa's avatar
AmedMesa
Copper Contributor
Oct 23, 2019

Combo box with "All" added to query and sorted on top.

I have a category list that will be added to a combo box.  Here is my SQL....   SELECT tblCategoryList.Category FROM tblCategoryList UNION SELECT "All" FROM tblCategoryList ORDER BY tblCategor...
  • AmedMesa's avatar
    AmedMesa
    Oct 25, 2019

    Thanks guys for helping me solve my issue. Here is my working code:

    ' SELECT tblCategoryList.Category As Category, "1" As ID
    ' FROM tblCategoryList
    ' UNION
    ' SELECT "All Tags", 0
    ' FROM tblCategoryList
    ' ORDER BY ID, Category;

    Basically I created a row in SQL called ID and all records added from the tblCategoryList table are labeled 1 under ID. The Union adds the "All Tags" and under the ID column the row is identified with 0. Then I sort via ID and followed by Category. Now I can keep the order ascending and no matter what the "All Tags" remains on top.

Resources