- Where Developers Learn, Share, & Build Careers
I have two tables in my database, one is a transaction and the other is transaction history. The latter is essentially an auditing table, so that a trigger triggers the screenshot of the data to execute on the insert, update and delete the transaction.
I am recovering all the data stored in the transaction table, which matches the column, but it is difficult, where I am trying to get data from another table using the foreign key I am For example:
One field in the transaction table is "TransactionType_TransactionTypeId", but in the audit table we want to store our 'name' equivalent "TransactionTypeName". It needs to be populated from the "Transaction type" table, in which the field is "TransactionTypeId" and "Name".
I am struggling to write a query to retrieve it as I want, I'm trying something like the following, but I'm achieving very little success: Transaction type with name from
SELECT @ TransactionTypeName = named from where it was inserted. TransactionType_TransactionTypeId = TransactionTypes.TransactionTypeId; I am thinking that this is a syntactic nightmare if someone can tell me in the right direction, I would be very grateful! ITRansactionTypeId = i.TransactionType_TransactionTypeId to get a name for the best On
Excluded External TransactionTypes in the form of TT should be included as the following
TransactionTypeName = by inserting TT.Name. But you have to know that there can be more than one line in the entered table, and you are getting the value for only one row.
Comments
Post a Comment