I'm have a database customer name and date are the composite keys. I'm trying to pull out the 'x' largest or smallest transactions on each date and insert it into another table along with the ranking.
I'm using this code on individual runs, but it won't work when run thru JDBC from java for multiple runs.
set @N = 0;
SELECT @N := @N +1 AS rank, name, purchase FROM t1 ORDER BY close purchase
limit 15;
Any suggestions?
it won't work? errors? incorrect behavior? does it work for the first run and fail on successive runs? or all runs?