Solved query data shift or move from clolumn to other

mhakim

Member
Local time
Tomorrow, 00:28
Joined
Jan 25, 2021
Messages
72
hi dears

good day

i am asking if i can


if there is null on column (name_english) then the yellow data move from (Chart_Name_English) column to the Null column

please look at PIC attached
 

Attachments

  • move data in query.PNG
    move data in query.PNG
    50.4 KB · Views: 256
Run an UPDATE action SQL

UPDATE tablename SET name_english = Chart_Name_English WHERE name_english IS NULL;

The data will be in both fields. Instead of actually copying the data, could just calculate this in a query (or textbox) when needed.

SELECT tablename.*, Nz(name_english, Chart_Name_English) AS EngName FROM tablename;
 
Last edited:
Run an UPDATE action SQL

UPDATE tablename SET name_english = Chart_Name_English WHERE name_english IS NULL;

The data will be in both fields. Instead of actually copy the data, could just calculate this in a query (or textbox) when needed.

SELECT tablename.*, Nz(name_english, Chart_Name_English) AS EngName FROM tablename;

where i can run this query

it give me message

operation must use updateble query

how can i use updateble query

i already have normal union select query as PIC

how do i run this SQL Statement to affect the query by new data
 
how do i run this SQL Statement to affect the query by new data
Create a new query by clicking query design tab
click on SQL View at the top left
enter the update query @June7 sent you, but change the table name to your own table name
save it.

The query will appear on the database window
you can then click it to run it.
 
What do you mean by "PIC"?
What exactly is the SQL statement you built?
Why is a UNION query involved? A UNION query is not an updateable dataset.
What are you really trying to accomplish?
 
hi dears

good day

i am asking if i can


if there is null on column (name_english) then the yellow data move from (Chart_Name_English) column to the Null column

please look at PIC attached
For your name_english column, you could try this.
Code:
NameEnglish: Nz([name_english], [chart_name_english])
 
1. As the others have mentioned, you should not store the same data in two places, especially in the same table. There are better methods.
2. If the field is text, it might contain ZLS rather then null since MS "helpfully" defaults the AllowZLS property to Yes rather than No. I recommend changing this default everytime you create a new text column. If you want code, I have a procedure that will fix all the tables in your database at once BUT, it will NOT fix existing records. You would need to run an update query to remove the ZLS value.
3. Fixing existing rows does not solve the problem. You also need to PREVENT future null values AND you won't be able to do that without changing the AllowZLS from Yes to No.
4. As your error message indicates, you can't update a union query.
 

Users who are viewing this thread

Back
Top Bottom