Let's say I have very simple table :
CREATE TABLE Bands (Name VARCHAR(20) NOT NULL) ENGINE = INNODB;
INSERT INTO Bands VALUES ('Hammerfall'), ('Helloween'), ('Haggard'),
('Therion'), ('Tarja');
And run a query :
SET @i := 0;
SELECT @i := @i + 1 No, Name
FROM Bands
WHERE Name LIKE 'H%'
On HeidiSQL and PhyMyAdmin it runs well :
1 Hammerfall
2 Helloween
3 Haggard
But in Delphi 2009 failed with error
SQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT @i := @i + 1 No, Name FROM Bands WHERE Name LIKE 'H%'
I write the query in TZQuery.SQL box, Query.SQL.Text and Query.SQL.Add(). All failed.
Is there a way to run that query?
The real query I will use is to join some 20+ columns tables to generate some reports. But I cant even make this tiny thing works ~__~