Thanks Robert. --- Robert Klemme <[EMAIL PROTECTED]> wrote:
> 2006/1/11, Alexei Novakov <[EMAIL PROTECTED]>: > > Hi list, > > > > I ran into interesting issue. I have a query: > > > > SELECT ID_F, (SELECT VAL_F FROM ...) AS VAL_F > > This cannot work because you cannot select an arbitrary amount of data > for a single field. It might, if you use an aggregation function such > as MAX, SUM etc. Otherwise you'll have to use an inline view (see > below) and join with that. Yes, of course, I wanted to have something simplified. As I said any kind of reference to the alias doesn't work. Like: SELECT ID_1, COUNT(*) AS TMP_FLD FROM TBL WHERE TMP_FLD = 2 GROUP BY ID_1 Will not work either. > I don't know what you want to query in the end, but do you probably want > this? > > SELECT ID_F, tsub.VAL_F > FROM MAIN_TBL, > (SELECT VAL_F FROM ... > WHERE tsub.VAL_F = 3) tsub > where tbl.idf = tsub.... > and .... > > The sub select is called "inline view" and it's definitely supported > by maxdb (at least from 7.5, can't speak for older versions) Yes, I thought about it, but my subquery is correlated and correlated subquery is not allowed for inline view in 7.5 as far as I know. Best regards. Alexei Novakov. -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]