does adding group by x.prod_id work?
SELECT
TOP 1
y.symbol,
x.prod_id,
FROM
x,
y
WHERE
x.date <= @some_date
AND
x.symbol = y.symbol
GROUP BY
y.symbol,
x.prod_id
ORDER BY
x.date
DESC
not sure the TOP 1 will work or not, if it doesn't then just omit it and fetch
the first row only. it work not hurt the performance.
in sql-92 standard, inner join is prefered instead of the 'where clause' for
joining.
--
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm