Default order by label on foreign keys

Allan_Whoops's profile image Allan_Whoops posted 9 months ago in General Permalink

I saw the original thread on this.

I have a table, Item, whose primary key is VARCHAR. I added another column, Category, which is also VARCHAR.

When adding an item to another table using the drop down list, the sort order is now on Category not Item.

Is there anyway around this please as it makes data entry exceeding long-winded?

Many thanks,

Allan

ansgar's profile image ansgar posted 9 months ago Permalink

I'm not sure I understand your question. I suppose you're talking about the drop-down in the grid where you select a foreign key value. HeidiSQL uses the first available VARCHAR or TEXT column in the foreign table and displays that value in the drop-down. You can work around that by moving the varchar/text column you want to display to a prior position.

grafik.png

Allan_Whoops's profile image Allan_Whoops posted 9 months ago Permalink

Thanks for getting back to me. The key is Item, I don't know if that is the problem.

There are only two columns, Item and Category.

Tried moving Item around, but it hasn't made any difference.

Thanks,

Allan

ansgar's profile image ansgar posted 9 months ago Permalink

You should perhaps post a screenshot of the problematic area. I can't see the issue.

Allan_Whoops's profile image Allan_Whoops posted 9 months ago Permalink

Thanks.

The first shows the table structure as is. The second, its contents The third, the contents of a table called inventory The fourth is adding a row and the drop down list - it is sorted on Category instead of Item The fifth shows the Item table rearranged The sixth shows that there is no difference to the sort order.

Does this make sense?

All the best,

Allan

1 attachment(s):
  • 2025-06-22-12_46_39-Recipes_fridges_inventory_-HeidiSQL-12.11.0.7065
Allan_Whoops's profile image Allan_Whoops posted 9 months ago Permalink

That screenshot is number 6

These are 1 -3

3 attachment(s):
  • 2025-06-22-12_42_06-Recipes_fridges_item_-HeidiSQL-12.11.0.7065
  • 2025-06-22-12_42_35-Recipes_fridges_item_-HeidiSQL-12.11.0.7065
  • 2025-06-22-12_43_06-Recipes_fridges_inventory_-HeidiSQL-12.11.0.7065
Allan_Whoops's profile image Allan_Whoops posted 9 months ago Permalink

4 - 6

3 attachment(s):
  • 2025-06-22-12_43_44-Recipes_fridges_inventory_-HeidiSQL-12.11.0.7065
  • 2025-06-22-12_45_47-Recipes_fridges_item_-HeidiSQL-12.11.0.7065
  • 2025-06-22-12_46_39-Recipes_fridges_inventory_-HeidiSQL-12.11.0.7065

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