How to sort the FK dropdown menu by 'id', not by 'name' ?

W0LF's profile image W0LF posted 8 months ago in General Permalink

I have a table ('main'), one of whose fields ('staff_id') refers to another table ('staff'). The dropdown menu from the 'staff' table is sorted by the 'staff_name' field, but I prefer it to be sorted by the "id" field. How to do it? Thank you!

2 attachment(s):
  • 2023-11-15_14-52-28
  • 2023-11-15_14-47-53
W0LF's profile image W0LF posted 8 months ago Permalink

How to change the "...ORDER BY staff_name..." to "...ORDER BY id..." from this query":

SELECTid, LEFT(staff_name, 256) FROMtest2.staffGROUP BYid,staff_nameORDER BYstaff_nameLIMIT 10000;

???

ansgar's profile image ansgar posted 8 months ago Permalink

HeidiSQL takes the first text/varchar column for sorting, and you cannot change this behaviour.

I am planning to replace that dropdown editor with a dialog supporting features like sorting, filtering and more. See issue #762 for updates.

Please login to leave a reply, or register at first.