Describe the bug
MySQL async do not accept SELECT query inside INSERT query
To Reproduce
-- this doesnt works
local type = 'licence'
local id = '64499c693ce22a57b735a4c56ac3c1fc8e0be406'
MySQL.Async.execute(
"INSERT INTO user (fivem_id, license_type) VALUES (@id, (SELECT id FROM license_type WHERE name = @type))",
{
['id'] = id,
['type'] = type
})
This query should work but see the image below.
But a SELECT query inside a SELECT query works, as it should!
-- this works
MySQL.Async.fetchAll(
"SELECT * FROM user WHERE fivem_id = @id AND license_type = (SELECT id FROM license_type WHERE name = @type)",
{
['id'] = id,
['type'] = type
}
Expected behavior
The query should be executed just fine, I don't know why it doesn't work, it's basic SQL stuff.
Screenshots / Logs
I did try to allow NULL on license_type so the query runs, but the the data created was this:
Describe the bug MySQL async do not accept SELECT query inside INSERT query
To Reproduce
This query should work but see the image below.
But a SELECT query inside a SELECT query works, as it should!
Expected behavior The query should be executed just fine, I don't know why it doesn't work, it's basic SQL stuff.
Screenshots / Logs
I did try to allow NULL on
license_type
so the query runs, but the the data created was this:Software: