Create custom field concating string and number

In my database I have the following structure:

  • Table A called "table.a"
id fields
1 ...
  • Table B called "table.b"
id origin fields
1 table.a,1 ...

where field origin doing reference to record with id 1 in table A. "X,Y", X is the table it references and Y is the record id of the table.

I need to make a query with the editor, where I combine the two tables by means of the source field. I have tried a concat concat("table.a", [ID]) but nothing.

Is there any way to merge those tables through the editor?

Not sure this question is totally clear.

Are you just having trouble joining the two tables?

What kind of DB are you using?

What do you mean by source field here:

where I combine the two tables by means of the source field

From what I can tell, your origin column in table B is meant to be a foreign key for [table.a].id? But for some reason you're storing some kind of string in the origin field which contains "table.a," then the id?

Generally, two tables are combined with a join. concat() is meant to concatenate strings.

Part of your problem may be that you have a period in your table name? But again I can't tell what you're asking or what the structure of your database is.



Origin field.

I store in that field the table name and the id separated by a comma.

The idea of this field is that it can point to different tables, i.e. it can point to table A (origin in table B is "table.a,ID") or to table C (origin in table C is "table.c,ID").

In this case I only want the records in table B that refer to table A via the origin field (it should have the following structure "table.a,ID")

To join the tables I would need to create a new field creating the string "table.a,ID" being ID the id of a record from table A. I have tried to do this with the concat function

As a sql query it is simple and I have done it several times. But from the editor it doesn't allow me to concatenate as it is a string and an integer (which is logical). And it doesn't allow me to cast the integer to a string either.


I created the sql query and used it as a starting point in a query with the editor.

But now I have tried to concatenate the string "table.a," with the ID and it has left me from the editor. It didn't complain that I can't concatenate strings and integers.