Bits & Pieces (Tuesday Night Open Mic)

Will Ferrell answers questions from the Internet. Unsafe for work. Profanity. Strong sexual content. Etc.

•••

Been a busy day. Busy beating Microsoft Sequel Server into submission. Simple enough, but I’m from an era of sequential scripts and Microsoft BASIC. Nesting select statements get just select the records for a school, year, and period with the most recent timestamp took me 3 hours to get working. Anyone who does this stuff knows how simple this is:

select * from (  

select S.schName as School, L.schYear,L.prd as period,jl.date_run as DateRun, ‘Approved’=case when status = 1 then ‘Y’ else ‘N’ end,  L.prvUser as AprBy,  convert(char(10),L.prvDate,101) as AprDate,L.schID as school_id
from adaLock as L
 

left join t_SchAtt as S on L.schId = S.schNum       

join Job_Log jl on (L.schId = jl.schoolid and L.prd = jl.period and L.schYear = jl.school_year) 

where  schYear = @schYear and prd = @prd 

union all select schName,@schYear,@prd,null,’Not Run yet’,null,null,null from t_schAtt where schNum not in  ( 

select schId  from adaLock where schYear = @schYear  and prd = @prd rty

)

group by schName  ) subSetx

WHERE subSetx.DateRun = (select max(date_run) from Job_Log jlo where jlo.period = subSetx.period and jlo.school_year = subSetx.schYear and jlo.schoolid = subSetx.school_Id) 

group by school,schYear,period,DateRun,Approved,AprBy,AprDate,school_id

But it took me 3 hours to make it work. I knew at the outset I wanted to select records where date_run = max(date_run), but finally finding the right combination to make it actually work . . . and they call SQL a natural language query language. Oh, brother!

56 Responses

  1. Select It_is_natural from Personwhere Person.you = SQL_Inventor

    Like

  2. Dave! . . . "The multi-part identifier Person.you cannot be bound."That's been my day!

    Like

  3. Anybody have a quick books question, lol?

    Like

  4. The Penn State football program is in trig bubble. Long time head coach Joe Paterno is planning an exit strategy.Tim Pawlenty has thrown his support behind Mitt Romney, an odd choice since Pawlenty spent a lot of time trying to out-TP the Tea Party affiliated candidates.I wish I had picked the Bears in my football pool this past week. Darn!

    Like

  5. kevin, you're making my head hurt. I am *not* a programmer or even close, but have had to learn enough to make several small databases function and improve. I am expected to perform miracles with no assistance because our wasteful government program has no funds for actual programming assistance. And it always seems to happen no matter how many times I attempt to requisition a sledgehammer during the process.

    Like

  6. Hi, MsJS. I have no love for Penn State football, but I think it's sad for JoPa to go out this way, if that does indeed happen.Does anybody care any more who Pawlenty supports?

    Like

  7. MsJS, do you have any insights for us as the OH returns come in? Do we have anybody in OH or surrounding states who currently is commenting here? Can sue not access here at all or is there something else entirely that accounts for her absence? And have I missed news about 12BB? I have not seen her here or on PL for a very long time.

    Like

  8. okie, the one I'm watching tonight is that MS "Personhood Amendment". I hope that sucker goes down. Looks like Ohio is going the labor way, over 60% right now.

    Like

  9. Good evening, lms.I'm watching MS too. It's relatively close, but I have no knowledge or commentary to know what it means with such small % vote reported so far. OH has been holding comfortably steady after dropping a few points from first returns.Isn't there also a VA state senate race that is important? Others?

    Like

  10. Oh yeah, there's the VA State Senate race but I haven't seen any results from that yet.

    Like

  11. Great! A good labor win in OH. Think it will be brought up in the R debate tomorrow night?

    Like

  12. And so far MS is holding as a no. One thing you can usually count on is Republicans pushing their look.

    Like

  13. look=luck………yikes

    Like

  14. How come our righties are always absent when there is an election watch, debate, etc.?

    Like

  15. lms, MS is narrowing again but still a comfortable lead. Still small % reporting.

    Like

  16. Interesting isn't it? It was that way at the Plumline also. I don't know who Dave is but he had a picture up for awhile under members, but it's gone now, dammit. I was hoping he'd stick around so maybe he'll be back. I'm wondering if he's someone from the Plumline though, not that it really matters.

    Like

  17. lms, mark posted a comment in a thread below explaining the connection to Dave! (Gawd, what a great name choice. I sometimes (and sometimes not) love how that punctuation works out. And I guess he'll come back if he wants to participate in a blog that includes politics as well as recipes and kids and whatever else life brings.

    Like

  18. Dave! You're a black cat! I used to have one who looks just like you–best mouser I ever owned. Welcome to ATiM (and what's the kitty's real name? My avatar is really Daisy, my beloved beagle girl).

    Like

  19. And wouldn't it be great if Dave! is female after I have consistently referred to Dave! as male. LOL

    Like

  20. okie–not to mention boots. Had another ride with my cop today (although somewhat anti-climatic because another officer came along since she'll probably be the one issuing orders on the ground for me on Race day) and he surprised me with some of the stuff he's picked up, so I know he's at least paying attention.

    Like

  21. Oh I missed that from Mark, I'll have to go look for it. Thanks. Yeah, I guess we're not the usual fare are we?MS, 58% no now, hope it holds.

    Like

  22. michi, your boots-cop-friend sounds interesting. But tread lightly?lms, MS is still holding. But is anybody else as amazed as I am that it is even this close? It just seems so…so…so…mind-bogglingly ill thought out.

    Like

  23. Treading lightly, okie, and we do have several mutual friends in common. I understand (and remember) your concern, though–and thanks.Re: MS. Far too often our Republican friends seem to vote with their hearts rather than their heads when it comes to personal issues (as opposed to collective obligation issues). 🙂

    Like

  24. Okie, I don't know if it's factual or not but I read last week that an outside religious group is responsible for the MS amendment. Apparently, they tried the same thing in another state and failed. I can't remember where I read it though so it's slightly speculative on my part. I may research it tomorrow if I have time.

    Like

  25. From Benen's summation of MS's ballot tonight:voters in Mississippi will be voting on the “Personhood” measures that would ban abortions, birth control, in-vitro fertilization, stem-cell research, and treatment of ectopic pregnancies.Wait one fricking minute! Is he right–they want to ban treatment of ectopic pregnancies?????? I haven't been paying attention to their proposal, once I heard their definition of personhood included a single-celled "organism", but they really want to allow women to die an incredibly painful death (along with the fetus inside her) in order to advance their agenda????

    Like

  26. And score one for the Unions in Ohio…with 63% of the vote.And the whole Penn State story is just awful.

    Like

  27. Evening, ashot. You're brave to join the girls.

    Like

  28. michi, had you not heard these things about the MS vote? It's why I said it was horribly not thought through. (Serious question, hoping I'm not offending you.)

    Like

  29. Haha… I may be a bit out of my league when it come to boot cop talk. Michi, just make sure he doesn't put a GPS tracker on your boots.

    Like

  30. lms, I had not heard anything about the MS amendment being sponsored and/or favored by any particular group. But then I was not following every revelation about it.

    Like

  31. ashot, if this site had a recomment or "up" button, I might be hitting it for your 8:45 CDT comment. 🙂

    Like

  32. Okie glad to see I am holding my own with the ladies. Now to research some ABA ethics opinions.

    Like

  33. From what I read, they were saying any fertilized egg is an embryo, it doesn't matter where it lands or if it lands, hence the confusion.Hey ashot, how's baby watch going? I'm so excited for you.

    Like

  34. The AP is reporting that Mississippi voters have rejected a ballot measure that would have defined life as beginning at fertilization.

    Like

  35. Baby watch is going well. We are both getting very eager for his arrival but realize we need to be patient. After all, my wife is still not quite 39 weeks yet.

    Like

  36. Well all, I'm out for the night. This time change is killing me and my puppy's waiting for me (husband too, lol).

    Like

  37. okie–no offense taken, I really did tune them out at the "a single cell is a person" stage, so hadn't paid any further attention. "Not well thought out" is putting it your most graciously polite terms!GPS on my boot, ashot–double plus good for the double entendre (and I'm referring to car tires here)!I'm about to head out, too, bit of a rough end to the day and must be up and at 'em first thing tomorrow. lms, this is the most wonderful time of the year AFAIC with the time change! Ah, fall back. . .

    Like

  38. AP is projecting the MS ballot initiative is defeated, thank goodness!

    Like

  39. It's interesting to me that in Ohio, their Constitutional Amemdment against a healthcare mandate was passed 65/35 and the repeal for CBR was 61/38, the results were more or less opposite. Talk about your mixed messages to Anthony Kennedy, what with the D.C. Appeals court on the one hand and actual, er, citizens on the other. As Ace asked over at the HQ, why didn't Roosevelt just have Congress pass a law mandating the purchase of war bonds? Woulda kept the interest waaaaaay down.

    Like

  40. okie: How come our righties are always absent when there is an election watch, debate, etc.?I can't speak for the rest, but after homework, all I wanted to do was sleep. I saw a little bit about the MS elections (since they're next door) on the 9:00 news. Republican governor won–first time a Republican has succeeded a Republican in Mississippi in forever. Looked like the Personhood amendment (that, if I'm not mistaken, defined like as existing the moment a boy has a twinkle in his eye and a girl gives him a come-hither stare) did not fare as well, which tends to reinforce the idea that the people, even in the most conservative states, aren't going to support outlawing abortion in all cases from the moment of suspected conception.

    Like

  41. McWing: " their Constitutional Amemdment against a healthcare mandate was passed 65/35 "I said from the beginning the Obama admin should have position the mandate as what it really is–a tax on not having healthcare insurance. That's a win/win for everybody. Either Obama gets his de facto "mandate", or states start passing constitutional amendments outlawing healthcare taxes. 😉

    Like

  42. "How come our righties are always absent when there is an election watch, debate, etc.?"Coincidence if true. I was out all night last night with a church function."And score one for the Unions in Ohio…with 63% of the vote."Indeed. I'm glad you put it accurately and not something like "one for the public" or "one for the middle class." It was a win for pure demogoguery, too.

    Like

  43. upthread there was a mention of VA state senate. As of this morning, GOP needs one seat to take control. and that race is headed to recount. GOP up by less than 100 votes, which will trigger a recount. GOP cruised in the house of delegate races and now has a 2/3 majority. there.http://www.thestatecolumn.com/virginia/virginia-election-results-control-of-state-senate-still-unclear/

    Like

  44. Went to my friend's memorial service most of the afternoon yesterday. Late in life he had joined a megabaptist church, but one known for its good works. I knew Jimmy 36 years. He was a brilliant architect who could visualize anything. He may have been an untreated bipolar, too. He was a veteran of: CIA, an RC altar boy upbringing, and AA. Jimmy lived with me for awhile in the 90s after his second divorce. When my secretary Denise's daughter Katherine was 5 Jimmy hooked her on art and would explain architectural drawings to her to her delight. That was 18 years ago. He quit his 3 pack a day habit 11 years ago. Not soon enough. He fished and hunted and was a crack shot and a gun collector. He started our Monday night men's group, which still meets, in 1991. He was complex. Jimmy's old friends – the men's group, builders and architects and engineers, people he mentored over the years, others, were on one side of the church. His church friends were on the other. It reminded of a wedding; bride's and groom's crowds. Lisa, who had lived with Jimmy these last 15 years, also an architect, sat with "us", although it had been her idea to join that church.The eulogies were about two different people: the Jimmy I knew, and the Jimmy who "had accepted Christ" in 2009. There were common points, but even they were different in emphasis. Example: his old friends knew Jimmy could visualize anything; the church folks who spoke called Jimmy a "visionary". The church folks said "amen" and "hallelujah" where we were grinning or crying.Perhaps I found it a bit unsettling.

    Like

  45. oh, and bond issue i mentioned yesterday is up 70-30. boo.

    Like

  46. good morning.i get separated from my laptop about 6:30pm central time so couldn't watch the returns with you. am just catching up now.brent's morning numbers thread is now up, btw.

    Like

  47. In other election news, MS Amendment 31 — the eminent domain reform referendum — passed overwhelmingly. I think there are only a few states left that haven't enacted some sort of post-Kelo eminent domain reform.

    Like

  48. NoVA: "oh, and bond issue i mentioned yesterday is up 70-30. boo."The school infrastructure bond? Yay! 😉Some people appreciate the need for public education. 😉

    Like

  49. my issue isn't with public eduction. it's with publicly administered eduction. i was actually glad to see 30% voted no. i expected 90-10.

    Like

  50. What distinction are you drawing? Is there a difference between "public" and "publicly administered?"Thanx in advance, for the explanation, if I don't see it until tonight!

    Like

  51. Mark: "Perhaps I found it a bit unsettling."During my cousin's funeral, the pastor spoke and it became a bit of a fire-and-brimstone sermon. I can't recall another funeral where I've heard Satan mentioned so often. Past that, he mostly had church friends eulogizing, and all that was fine, but his pastor was a little–I dunno, tone deaf. I was younger when I went to my grandmother's funeral. She went to a more liberal, Episcopalian church–and they were pushy about coming back sometime, think about joining the church, and during the funeral they did sacraments, and everybody was drinking out of the same cup of wine or grape juice. All they did between people was wipe the lip of the cup with a dirty rag. My wife and I passed, but they were pushy about that, too, and obligated us to say: "No, we're not going to," out loud, having not taken the shaking of head and hand-dismissing gesture as the universal symbol of "no" that they are. Over time, that's struck me as inappropriate for a funeral. At the time, I just didn't want to drink after a dozen strangers and several wipedowns with a dirty rag.

    Like

  52. hi mark — this deserves it's own post, but we can fund eduction, but that doesn't mean the government has to own the buildings, employ the teachers and administrators, set the curriculum, etc.

    Like

  53. qb: "It was a win for pure demogoguery, too."As are, in my opinion, most ballot initiatives. It's how we roll!

    Like

  54. NoVA: Being in education, I can say that I don't think there is a functional problame with the government employee the teachers and owning the buildings, etc. It's when you get to setting the curriculum, determining testing. etc. My observational experience is that there is a tendency with centralized setting of curriculum and standards, etc., to standardize that which should not be (or should not be standardized without input from stakeholders; this is especially true of teacher testing/evaluation and most governmental merit initiatives), while not standardizing things that ought to be standardized, at least throughout a given system (which is getting worse with the addition of charter schools). That being said, most school systems, while publicly administered, also involve a fair amount of private administration, consultation and management, often contracting out everything from janitorial services to cafeteria management to entire departments, including chunks of IT. The involvement of the federal government is not terribly helpful. I think it's ironic that programs like Race to the Top and No Child Left Behind, and similar state based evaluation or testing initiatives, simply increase the compliance workload for teachers and administrators, leaving them less–not more–time to focus on the children. I've spent an inordinate amount of time (including the 3 hours yesterday I mentioned) on complicated, arbitrary state reporting (much of it based on gender and ethnicity, with which nothing is done, but I digress), when there are only 3 important numbers which mean anything in terms of how money is allocated. The rest are numbers that higher-ups decided might be nice to have, which are never used or paid attention to again after the committee meeting, but represent a huge chunk of time to both develop and maintain . . . but, having worked for various private businesses, this is not unique to government bureaucracy. I should add, our student management system has built in reporting that provides those numbers, with small variations. Because of the opinions of a few various committees and a few different levels of government, we don't use those numbers, but have a committed a huge amount of money and time to our numbers, which are almost identical (although, in fairness, we also have not unreasonable retention policies regarding the reporting, with which our Student Information Management System is not in compliance).

    Like

  55. Mark, sorry to hear that the memorial service for your friend was unsettling to you. I don't believe I have ever attended one that was not. Since my sister's death, I have been communicating with my family about my wishes for my own service. I have made it very clear: NO PREACHING, NONE WHATSOEVER. I doubt if they will honor that when it comes down to it, but at that point I will not care.kevin, I too had an unusual experience with a religious funeral years ago. The service was for my husband's grandmother. His grandparents had recently moved and, while quite religious, had not yet settled into a new church. Result: a pastor who did not personally know her so had nothing to say about her personally (and did not ask family anything about her) substituted a crucifixion sermon complete with gory details. He never once mentioned the decedent. It was disgusting, and my husband and I walked out.

    Like

  56. "functional problem with the government employee the teachers and owning the buildings"i think it hurts competition. my goal would be to break the effective monopoly the state has on education, starting from the ground up. (got to run)

    Like

Leave a reply to ashotinthedark Cancel reply