what about duplicating the column as a varchar and querying the new column while leaving the old column unchanged?
Is there a way to duplicate an entire column and have all new entries duplicated as well? Problem is I have three different dashboards that share that same data. New data gets added every day.
Yes, like this (in Navicat):
I have an existing price column. Iāve created a virtual column (which will take no extra space - itās calculated on the fly) with āpriceā as the expression and defined as VARCHAR - named āprice_textā. Having created this column, you will have a new, text version of the price column. It would be a duplicate and will keep in sync with the main price column.
Virtual columns can also be stored - so they do take space. Iām not sure which you will need in this case.
Strange, I have the latest version of Navicat but donāt have the virtual option? Does it need to be turned on somewhere?
I donāt think so - but the problem could be that youāre using an older version of MySQL. You need version 5.7. I should have mentioned that.
Yeah, that could be it. Mine is 5.6.14 ā¦ not having a good day. lol
Thatās a pity. You could create a new column for you VARCHAR version and update it to have the same values as the INT number column. Then create a trigger to set the value of this new column to the INT column - on both insert and update. I think this should produce the same result.
The query builder wonāt allow it, it is very strict. You can edit the json in the action file to change it to begins with. Just select equal first, then edit the file and change the equal operator in begins_with. Or choose a string column and use the begins with condition there and change the column name afterwards in the action file.
Iām going to lose this battle but anyways
Why not just allow it in the query builder if it works?
I suspect because it doesn work in all platforms or indeed all versions of mysql
Patrickās solution, assuming it works, doesnāt seem a bad workaround
I know with MSSQL you have to CAST the value first to the correct type or you will get an error. MYSQL seems to be less strict and does it for you. Other databases I donāt know, but according to the standard it should give an error.