• l543123 (3/17/2010)


    "First of all, you run a script to find Contractor and Expense tables across all databases on you production server"

    sorry if I am wrong, but why are you searching all databases and if you dont know the tables then what are you searching 🙂

    also I think its a lot of code for something like,

    select contractor name, max of expense and date from contractor

    inner join expense on expense.contract_id = contrator.id"

    That won't work. What if the highest expense is on a different date than the one you want? Max gives the highest value in the column for the rows defined in the Group By clause.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon