MS-Access: Replace values in column based on mapping list - ms-access

I got a column with 27 thousand entries. I want to replace all occurences of "a" with "a_new", all occurences of "b" with "b_whatever". And so on. I got more than 1200 of these mappings. Can I somehow put my mappings into a list and feed it to MS-Access so that it replaces the values in a specific column?

Create new table with mapping - [OldValue] and [NewValue] columns, then join this table with your existing table by [OldValue] column and update by value from '[NewValue]`

Related

Is it possible to create a MYSQL view where a single field could be populated from two different fields in a table based on a condition?

I am trying to create a View using certain fields from a single MYSQL table. But in one of the fields in the Table, I need to populate the field from either one field in the table or another field in the same table based on the value of a third field in the table. Is this possible, and if so, how?
To explain, The table contains data from two suppliers. The entries in the table from "Supplier A" store the Account Number in field CustomerNumber while the entries in the table from "Supplier B" store the Account Number in field CustomerAcct. The view I need to generate needs to list all of the customer orders from both suppliers combined, and populate a single field in the view called AccountNumber with either the value from CustoomerNumber or CustomerAcct, depending on which supplier filled the order.
Is this possible?
You'd use the "case" function, as in mysql case
CASE
WHEN Supplier = 'A' THEN customernumber
ELSE customeraccount
END as accountnumber

Multiple same kind of column concatenation in another column of same table in mysql

I have one table "Mytable" and in this i have multiple columns and now in this columns i have 100 columns with same name like "type1", "type2"..,"type99" and i am importing this value from csv. so now what i want to do is i want to combined all this column value in one single column in json format.
Can any one suggest me how can i achieve?
You can create the json object as:
select json_object('type1', type1, 'type2', type2, . . . )
Alternatively, you might want an array.
You can then insert this into a new table.

MySQL SELECT Key Value table as row

I have the following MySQL table "application_session" with the following columns:
- applicationId
- applicationKey
- applicationVal
- applicationDate
This table has many key/value pairs in it, keys and vals can change, new pairs can be added or removed. Furthermore, every "applicationId" can have different key/value pairs from others.
What's the best way to dynamically return (SELECT query) all pairs in a rows where "applicationKey" is the column name and "applicationVal" the result?
I hope I'm explaining things right.

Adding a column of data

Not been able to find something that matches what I am setting out to teach myself, so here goes:
I have added a column (called status) to an existing table (called fruit). All values in this new column are currently null. Other columns in this table are id (primary key int(11) ) and fruitname.
My question is this:
Is there a command I can use to populate this column in one go? Or do I need to update each row one by one?
Ideally I am looking for something that populates columns in the same way insert does to rows. Something where I can specify the table and column name and then list the values to fill down.
If you want the new column status to have same value for all records like Fresh then you can do it in one go like
update fruit set status = 'fresh'
Else, you have no other way than performing an UPDATE row by row and populate the status column value for each fruit record.

How to update all fields form one table to another [MySQL]

I have two tables with a lot of fields
table - A
table - B
in table A only two fields are filled all other are empty, but exactly that fields are filled in table B
I would like to
UPDATE A, B set A.c = B.c, A.d = B.d .... WHERE ....
but there are a bout 100 columns, is there any way how to update all fields in A from B except 1 particular field ? Is there any way how to tell mysql left 1 particular fields in A as it is.
If field name in table A and B are same then you can just use excel to build the string.
Copy the entire structure of DB table A into excel as 1 column and then use excel formula with string concatenation to build the required string.
It should not be that difficult task.
From MySql end, you can review DELETE and INSERT option with help of temporary table. More details needed to think of solution at MySql end.