To get the Max value from one column with case statement without using any aggregate functions

  • nadabadan (2/13/2011)


    Craig Farrell (2/13/2011)


    EDIT: I was going to respond again but then I realized I was answering the exact same argument for the third time. You ignore half of what I say and then mis-state the other half. I leave you to your own demise.

    Talk about projecting. That's what you do, that's what you've done since your first post. Attributing arguments to me that I never made. Then arguing against them. We can agree on one thing, this thread is done. I'm done with your nonsense.

    Heh, I was the one that said you're projecting. And then you accuse him of attributing arguments to you that ou never made. Fun-ny! Fun-NY! Seriouly, keep it up, you could become a meme. If you take this act to a more general audience you could have people laughing all over the internet!

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    It’s unpleasantly like being drunk.
    What’s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams

  • nadabadan (2/8/2011)


    GSquared (2/8/2011)


    nadabadan (2/8/2011)


    GSquared (2/7/2011)


    nzngh (2/6/2011)


    It was an Interview question, surly I couldn't answer it. I have tried it in any possible way that I know but I got only Null though with two column of min and max it works and give me min and max but having only one column nop.

    My reply would be, "Why would I use an oddball solution like that when Min and Max are built for that kind of thing? Building code that follows common, standard practices makes it easier to document and maintain. Building code with 'tricks' that nobody knows makes it more difficult on everyone, including me. So why would I do something like that?"

    I see three possibilities here:

    1. A prior dev/DBA used oddball tricks like that, and everyone currently working there hates it, and it's a "trick question" to see if you'd continue practices that everyone hates.

    2. The person doing the interview uses oddball tricks like that, either out of miseducation, ego gratification, or "job security".

    3. The company or department has policies that force them to use oddball coding practices, probably due to Pointy-Haired-Boss Syndrome.

    If it's either 2 or 3, you don't want to work there anyway. If it's 1, then my reply would get a good reaction.

    Or how about if you want to see how much a person REALLY knows about T-SQL or want to see their thought process. I doubt these people actually use the CASE statement to find the MAX value. But forcing someone to write a solution using CASE shows whether that person has some experience in T-SQL or just some superficial knowledge of T-SQL gleaned of a book the night before the interview.

    If that's the answer to my question about oddball solutions, then I'll point them to this site, where they can see dozens of my posts that include T-SQL solutions I've come up with.

    And no one would be impressed. Take a deep breath and think about the question and WHAT the question is trying to get at. Do you really believe anyone would implement a CASE method over a MAX function? Your 3 possibilities are a joke. Did you throw a hissy fit when your math teacher asked you to put away your calculator for a test on long division. Someone answering "SELECT MAX( columnid ) FROM table" reveals nothing to interviewer. But having someone implement an ALGORITHM to find the maximum value tells me that the interviewee has a good grasp of T-SQL, the underlying logic and implementation and has an ability to think.

    Nadabadan:

    Here's where you got insulting. This is the first insulting post in this thread. It's yours. Nobody else "started it".

    That post from you, in reply to a simple suggestion that, in my particular case, someone could gather more, more useful, and more complete data, about my abilities with T-SQL by reviewing posts and articles on this site, than they can by having me step through an academic exercise, is full of insults, arrogance, and attacks. You attacked me. Not the other way around. Nobody attacked you at all, until after this.

    Since that point, when gently asked to consider manners on the subject, you have moved over to calling people morons, liars, incompetent, mindless, etc.

    Nothing I or anyone else posted before your attack on me was in any way insulting to you, unless you are the person who asked that particular question in an interview. You have since then asserted that you were not.

    Hence, I would recommend that you take a deep breath, step away from this thread, and reflect a bit on the subjects of manners, respect, and taking offense to things that aren't offensive.

    I've tried to reason with you, publicly and privately, but it isn't getting anywhere so far as I can tell. I recommend we end off here, as I suggested several days ago. We have fundamental disagreements, and a public forum like this isn't going to resolve them.

    If you're right, we're all beyond your help anyway, so stop wasting your time on this. Either way, it's not worth continuing.

    - 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

Viewing 2 posts - 76 through 76 (of 76 total)

You must be logged in to reply to this topic. Login to reply