Sql Custom Query 关注
I have an issue with my Bartender Query, well first I have to explain the situation:
We have to make a label which needs data from 2 tables in our DB, unfortunately the DB design is a sh*t, the relation field in one table is numeric and in the other table is char, so the data "00012345" is not equeal to 12345 (the left zeros are not stored in the numeric field).
I need to:
1.- Create a query in which I can put an IF...ELSE statement, I mean, SELECT field1, field2, from TABLE ... WHERE IF LENGHT(field1) < 8 ... and then concatenate as many zeros as the data needs.
2.- Store in a variable the data that has no left zeros, concatenate the zeros and then use this variable in my WHERE clause.
Ok, I can not change the data type in the DB field because it is validated in other apps.