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. > FROM MAIN_TBL > WHERE VAL_F = 3 > > This doesn't work: > > Unknown column name:VAL_F > > Actually I cannot refere any field by alias, not only subselect, but for > other types of fields > there are other ways to refere them. > > Is there any way to refere this VAL_F field in the condition? 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) Kind regards robert -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]