Is there a way to add another column to a table with a dataset from a transaction group?
I want to match the code from the first column to text that I would put in the added column.
The text associated with the code number is not in my transaction group.
Like if I know 2101 means the part is too small, and I want my table to also show the reason.
If you’re querying a database you can also add it to your query. Something like:
WHEN 1 THEN 'ON'
WHEN 2 THEN 'OFF'
END as explanation,
There might be a better way than CASE. If there is I’m sure someone will suggest it.
An oft-used method would be to create another db table with the codes and descriptions on it, the use a JOIN clause in the query
SELECT table1.col1, table1.col2, table1.status, table2.description
LEFT JOIN table2 ON table1.status = table2.status
that seems very efficient
what is the good way to create the table?
Your DB tool of choice (Management Studio, Workbench, DataGrip, et al) is fine. This, generally speaking, would be a static table, once all your codes are in.