[Solved] How to use variables defined with @ in a base query
Posted: Tue Mar 14, 2017 11:57 am
Hi there,
I need a help with MySql query containig variable definition.
I created my query using squirrel sql client and it work fine with it:
As you can see, in the query I use variables to calculate some values.
If I try to create a query in libreoffice base I get an error like that:
SQL-Status: HY000
Fehler-Code: 1000
syntax error, unexpected $end, expecting BETWEEN or IN or SQL_TOKEN_LIKE
Unfortunately I'm unfamiliar with base syntax and need your help guys. What is wrong with the syntax?
Regards, madlena
I need a help with MySql query containig variable definition.
I created my query using squirrel sql client and it work fine with it:
Code: Select all
select
@last_start as rehearsalStartTime,
@rehearsal_duration := addTime('00:05:00', addtime(cStrDuration,cStrDuration)) as rehearsalDuration,
@new_end := addtime(@last_start, @rehearsal_duration) AS rehearsalEndTime,
@last_start := @new_end as new_last_start,
a.*
from vShowAct a,
(SELECT @rehearsal_duration := 0, @last_start:='17:30:00', @rehersalDate := '2017-03-31') AS vars -- variable initialization
where a.cSacRehearsalDate1 = '2017-03-31'
order by a.cSacRehearsalDate1, a.cSacRehearsalNumber;
If I try to create a query in libreoffice base I get an error like that:
SQL-Status: HY000
Fehler-Code: 1000
syntax error, unexpected $end, expecting BETWEEN or IN or SQL_TOKEN_LIKE
Unfortunately I'm unfamiliar with base syntax and need your help guys. What is wrong with the syntax?
Regards, madlena