Skip to main content

How to use fields in MySQL query

More
5 years 7 months ago #328954 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.

Please Log in or Create an account to join the conversation.

More
5 years 7 months ago #328956 by nicolas
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

Please Log in or Create an account to join the conversation.

More
5 years 7 months ago #328993 by danidek
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
Powered by Kunena Forum