I want to write SQL queries in a PowerShell script to run them with Task Scheduler later.
$db = 'hotels'
$user = 'root'
$pass = ''
$mysql = 'C:\mariadb\mariadb-10.3.12-winx64\bin\mysql.exe'
$params = '-u', $user, $db
& $mysql @params -e 'SELECT user FROM ondemandscheduledrequests ORDER BY id DESC LIMIT 1' hotels
Start-Sleep -Seconds 10
I tried a simple one like this.
When I performed a SELECT * query it worked fine, but when I try to retrieve a single field, I have this displayed:
I don't understand why it is not working.

hotelsat the end ?