It looks like I need to define all the same column names in my joined query one by one to be able to see the same columns names that the first table and second joined table has like this:
Because when I select all columns, I'm not able to see the column names separately if that column name is also in the joined table. I also cannot see the data inside. The same query does show same columns on MySQL client. I think Retool get confused when it see two same column names and cannot differentiate them.
How to solve this situation?
Do I have to always go through all the same column names and point them in my mySQL query when I try to connect 2-3 tables with tens of columns?
Any answers to make it in an easy way? Otherwise I need to find all the same column names and need to put different names on each
Hi @Onur_Bolaca ,
Not sure what you mean.
You're joining 2 or more columns and want to show all the columns using table1., table2. which might contain same columnnames?
Yes and the problem is Retool doesnt let me do that if I don't point the column names as different names:
This doesn't work:
And yes I checked if there is another order_id on the results but non.
So basically Retool cannot populate columns which has the same name.
Is there any solution for this?
Not that I'm aware of. Indeed it is annoying to add all separate columns. It appears that now the columns with same names are overwritten or ignored. It would easiers of the table names or alias would be included (in case of duplicate names).
This isn't a retool issue, is it?
Google says you could do this... "sql dynamically alias column name"
Try to use the AI generator in the query field within retool and write something like
@matth , yes and no, I’ve seen more applications with the same issue, but a lot of applications just rename the columns to tablename.columnname
This will avoid duplicate column names. Downside of this is, that the columnnames look really ugly and become long. So better to use aliases.
Also best practice to only select the columns you actually need instead of just select all columns as this can really slow down your query or app.