[thelist] sql help

Richard Bennett richard.bennett at skynet.be
Mon Sep 15 13:20:09 CDT 2003


Hi,
Thanks for posting a complete example. It took me some time to get round to
trying it, but finally it helped me on the way ok.

Thanks.

----- Original Message -----
From: "Joshua Olson" <joshua at waetech.com>
To get the data you want, try something like this:

SELECT aday, user
, (SELECT TOP 1 status
    FROM userdata ud2
    WHERE ud2.thedate <= userdata.thedate
    ORDER BY ud2.thedate DESC) AS status
FROM thedates
LEFT OUTER JOIN userdata
ON userdata.thedate = thedates.aday
ORDER BY aday

This is of course the quick and dirty brute force method.



More information about the thelist mailing list