• Dbloc (1/31/2012)


    I must mention that there are some other columns in the table that are specific to each row. I should have mentioned this right away but forgot. sorry 🙁

    So having min and max date in the same row wouldn't work.

    I would need something like this:

    bldgid userID dateid score1 score2

    1 1 123 90 99

    1 1 124 89 88

    1 1 125 99 99

    .

    .

    .

    I need a query that will pull the first row and the last due to the dateid being the min and the max...

    Hope this helps. Sorry for the confusion.

    Assuming no duplicate dateids you could do something like

    SELECT * FROM MyTable

    WHERE dateid = (SELECT MAX(dateid) FROM MyTable)

    OR dateid = (SELECT MIN(dateid) FROM MyTable)