ChrisB: Select in Select in SQL

Beitrag lesen

Hi,

ich benutze MySQL 4.0.21-standard und versuche folgende Syntax:

SELECT distinct t.pid, slog.tstamp,(SELECT MAX( tstamp ) FROM ...

Also eine Subquery.

Der Fehler kommt nur wenn ich diesen SELECT in den anderen SELECT einbaue. Kann man es anders machen oder warum bekomme ich diesen fehler?

http://dev.mysql.com/doc/refman/4.1/en/subqueries.html:
Starting with MySQL 4.1, all subquery forms and operations that the SQL standard requires are supported, as well as a few features that are MySQL-specific.
With MySQL versions prior to 4.1, it was necessary to work around or avoid the use of subqueries. In many cases, subqueries can successfully be rewritten using joins and other methods. See Section 12.2.8.11, “Rewriting Subqueries as Joins for Earlier MySQL Versions”.

MfG ChrisB