- Posts: 13
- Thank you received: 2
How to use fields in MySQL query
5 years 7 months ago #328954
by danidek
How to use fields in MySQL query was created by danidek
I want to run a mysql query as a mass action, the trigger is after order update. I tried to use the fields of the current order but no success.
For example this is an SQL:
insert into amim_test (test_text) values(order_id)
or
insert into amim_test (test_text) values(product_id)
result is and error: Unknown column 'order_id' in 'field list'.
How can I use the values from the result of the trigger?
I want to save some data from the order into a table. The examples are test SQLs only.
I need at least the userid of the customer, but prefer to learn how to use all available fields.
For example this is an SQL:
insert into amim_test (test_text) values(order_id)
or
insert into amim_test (test_text) values(product_id)
result is and error: Unknown column 'order_id' in 'field list'.
How can I use the values from the result of the trigger?
I want to save some data from the order into a table. The examples are test SQLs only.
I need at least the userid of the customer, but prefer to learn how to use all available fields.
Please Log in or Create an account to join the conversation.
5 years 7 months ago #328956
by nicolas
Replied by nicolas on topic How to use fields in MySQL query
Hi,
You need to use {} around the column names.
In an "order" mass action, you'll be able to use all the columns of the order table: {order_id} {order_user_id} etc
You need to use {} around the column names.
In an "order" mass action, you'll be able to use all the columns of the order table: {order_id} {order_user_id} etc
Please Log in or Create an account to join the conversation.
5 years 7 months ago #328993
by danidek
Replied by danidek on topic How to use fields in MySQL query
Oh fine, it works! Thank you for your kind help!
The following user(s) said Thank You: Philip
Please Log in or Create an account to join the conversation.
Time to create page: 0.225 seconds