Auto Handling of same column name in DB Query Builder

Hello,

while working with multiple tables with same column names, we see that we have to compulsorily set ‘alias’ for the query to run properly.

see items 6 & 8 in the attached image:

request is that ‘alias’ for columns should be auto added whenever new columns are added to DB Query Builder which are from different tables but have similar names.

tiny thing, but makes Wappler more intuitive and user friendly, right?

I think I would rather aliases were not automatically set, but as long as we could change what was created default, I dont’ think it matter.

Presumably in the example above you have chosen the alias names which are most meaningful to you. If the automatic names were a single character (as they might reasonably be), then you might want to edit them.

It’s late…
Surely it would be better to have “table.column” as the column unless specifically given an alias?
I can’t see a way of aliasing tables and so this is the only option.
You already have “table.column” in the example above and so why not have Wappler reference this in the same way elsewhere?
Alias should really only be given where you are using the aggregate function to provide a calculation or similar.

I never have this problem to start with. In the past I have learnt my lesson and now I do not ever have the same field name in any of my databases.

as an example: in the Categories table I have the following fields
categoryID
categoryName

in the Products table:
productID
productCategoryID
productName

This naming convention has saved me from going bald :sunglasses: unlike this emoji.

2 Likes

sure, being able to edit even after auto add will be required.

Currently, when you add a second table, a dialog appears with the cursor blinking in the Alias field. I would have thought this was very clear and adequate as it is. Obviously a default could be added at this point; I wouldn’t have though it would be much of an advantage.

image

sure this is a better way - but still there would be cases where our request will be helpful.

this alias is for the table, and yes, we did see this and had added it as well.

what we are pointing out (in the image in first post) is the alias for the column name for the selected columns only.

even after adding the table alias, we still had to add the selected column alias for 6 & 8 as shown in the image for the query to give an output.

Looking more carefully now at your first post, I see what you mean. I haven’t come across this problem before and it’s useful to know - thanks.

2 Likes