Matt’s Journal

23 Mar, 2006

SQL can go suck my balls…

Posted by: Matt In: Angry| General| Tech| Work

Wow, what a day. Today was spent wrestling with a half ready database trying to output the correct entries for a paper mailing we were due to send out. We have roughly 17,000 contacts and I we wanted to setup a query so that the mailout was sent to a) Everybody who had been added to the database in the last 3 years b) Was flagged in the database as being eligible for a mailing c) Had to be in either Europe or the UK (basically excluding the world).

The query itself was fine, the results however werent. We had people who were flagged as “Do Not Mail” in our old database cropping up in the query results on the new one. Going in to check, the flag is not there…..great.

I get on the phone and talk to the database company, they say they will look into it and then come back 30mins later saying it is all fixed, apparently there were only 35 people in the query who came up as this. This was wrong, we found people who had no address being touted for the mailing, myself included for some unknown reason, it was complete bollocks.

The thing is, it got to the point where I started to think “is it me?!” and was so frustrated I sat on the floor and had 10 minutes time out from it all. People in the office were saying that they had never seen me like it before, I had got so frustrated that I was sitting on the floor trying to take time out.

I had never used the old database, I only picked up the new one this Monday and I was knee deep in Admin functions that I really wasnt prepared for, I’m the web designer for heavens sake!

I said to my boss “I am going to go home, listen to some loud music and destroy something beautiful”, that was greeted with some laughter, so that brightened me up.

I did go home and listen to some music, I blasted some Panic at the Disco! on my iPod on the way home but unfortunately didnt get the chance to destroy something beautiful.

If you are wondering what that SQL statement looked like, here you go:

SELECT A1.CONTACTID, A1.NAMELF, A2.ADDRESS1 A2_ADDRESS1, A2.ADDRESS2 A2_ADDRESS2, A2.ADDRESS3 A2_ADDRESS3, A2.CITY A2_CITY, A2.STATE A2_STATE, A2.POSTALCODE A2_POSTALCODE, A2.COUNTRY A2_COUNTRY, A1.NAMELF FROM CONTACT A1 INNER JOIN ACCOUNT A4 ON (A1.ACCOUNTID=A4.ACCOUNTID) INNER JOIN ADDRESS A2 ON (A1.ADDRESSID=A2.ADDRESSID) LEFT OUTER JOIN E1TB_CONEXT A3 ON (A1.CONTACTID=A3.CONTACTID) WHERE (A3.ACCEPT_MAILING=’T') AND (A4.CREATEDATE>:DateTime0) AND ((A2.ROUTING<>‘World’) OR (A2.ROUTING IS NULL OR A2.ROUTING = ”)) ORDER BY A1.NAMELF ASC

I am also trying to write a small piece for the NewOrder Newsletter but I just cant get round to it, sorry to all those involved for my lack of creativity, im sure you all understand the situation im in as you have probably had the same or worse!

Off to bed, im shattered.

Share and Enjoy:
  • Mixx
  • Digg
  • StumbleUpon
  • Technorati
  • del.icio.us
  • Furl
  • Ma.gnolia
  • Reddit
  • Facebook
  • TwitThis

No Responses to "SQL can go suck my balls…"

Comment Form


Locate Me

Delicious  Digg  FriendFeed  Last.fm  LinkedIn  Mixx  MyBlogLog  StumbleUpon  Picasa  Plurk  Google Reader  

Add Me On Xbox Live