Click here to Skip to main content
15,897,371 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: How to code complicated actuarial formulas in C#?! Pin
jhwurmbach8-Nov-07 23:05
jhwurmbach8-Nov-07 23:05 
GeneralRe: How to code complicated actuarial formulas in C#?! Pin
Phil J Pearson8-Nov-07 2:06
Phil J Pearson8-Nov-07 2:06 
GeneralRe: How to code complicated actuarial formulas in C#?! Pin
Russell Jones13-Nov-07 2:51
Russell Jones13-Nov-07 2:51 
AnswerRe: How to code complicated actuarial formulas in C#?! Pin
jhwurmbach8-Nov-07 21:47
jhwurmbach8-Nov-07 21:47 
GeneralRe: Unable to open web project?? Pin
Anthony Mushrow6-Nov-07 14:15
professionalAnthony Mushrow6-Nov-07 14:15 
GeneralRe: Unable to open web project?? Pin
Pete O'Hanlon6-Nov-07 22:58
mvePete O'Hanlon6-Nov-07 22:58 
GeneralRe: Unable to open web project?? Pin
Jordanwb29-Jan-08 6:53
Jordanwb29-Jan-08 6:53 
GeneralSQL query - which version do you prefer? [modified] Pin
GuyThiebaut5-Nov-07 22:38
professionalGuyThiebaut5-Nov-07 22:38 
These two queries return the same result set(different results as different fields).
A colleague wrote the first query and I wrote the second.

Now I think the first one looks just plain ugly, however the execution plan is not too dissimilar to the second query, which I wrote.

Is there any rationality to my response of Urghhhh?

My colleague's version:
select 
sat.salesnumber,
pjq.pickjobnumber
 
from
 
(select salesnumber, rownumber, invoiceaccount
from salestable
where dataset = 'wtl'
and ltrim(salesnumber) = '331299') as sat
 
join
 
(select * from 
pickjobtrans) as pjt
 
on sat.rownumber = pjt.picksalesrecid
 
join
(select * from
pickjobqueue) as pjq
 
on pjt.pickjobnumber = pjq.pickjobnumber
group by sat.salesnumber, pjq.pickjobnumber
</code>


My version:
select distinct pjq.accountnumber,pjq.status
from pickjobqueue pjq
right join pickjobtrans pjt
on pjq.pickjobnumber = pjt.pickjobnumber
right join salestable sal
on pjt.picksalesrecid = sal.rownumber
where ltrim(sal.salesnumber) = '331299'
</code>





You always pass failure on the way to success.

GeneralRe: SQL query - which version do you prefer? Pin
Giorgi Dalakishvili5-Nov-07 23:23
mentorGiorgi Dalakishvili5-Nov-07 23:23 
GeneralRe: SQL query - which version do you prefer? Pin
s.hatchard6-Nov-07 5:52
s.hatchard6-Nov-07 5:52 
GeneralRe: SQL query - which version do you prefer? Pin
GuyThiebaut6-Nov-07 9:28
professionalGuyThiebaut6-Nov-07 9:28 
GeneralRe: SQL query - which version do you prefer? Pin
snorkie6-Nov-07 8:18
professionalsnorkie6-Nov-07 8:18 
GeneralRe: SQL query - which version do you prefer? [modified] Pin
GuyThiebaut6-Nov-07 9:16
professionalGuyThiebaut6-Nov-07 9:16 
GeneralRe: SQL query - which version do you prefer? Pin
Pete O'Hanlon6-Nov-07 23:12
mvePete O'Hanlon6-Nov-07 23:12 
GeneralRe: SQL query - which version do you prefer? Pin
Phil Osborne6-Nov-07 23:22
Phil Osborne6-Nov-07 23:22 
GeneralRe: SQL query - which version do you prefer? Pin
Russell Jones7-Nov-07 3:24
Russell Jones7-Nov-07 3:24 
GeneralRe: SQL query - which version do you prefer? Pin
Vasudevan Deepak Kumar6-Nov-07 23:49
Vasudevan Deepak Kumar6-Nov-07 23:49 
GeneralAssignment [modified] Pin
Jim Warburton5-Nov-07 6:39
Jim Warburton5-Nov-07 6:39 
GeneralRe: Assignment Pin
James R. Twine5-Nov-07 6:45
James R. Twine5-Nov-07 6:45 
GeneralRe: Assignment Pin
leppie5-Nov-07 8:23
leppie5-Nov-07 8:23 
GeneralRe: Assignment Pin
James R. Twine5-Nov-07 12:00
James R. Twine5-Nov-07 12:00 
GeneralRe: Assignment Pin
Chris Meech5-Nov-07 8:55
Chris Meech5-Nov-07 8:55 
GeneralRe: Assignment Pin
KarstenK8-Nov-07 2:59
mveKarstenK8-Nov-07 2:59 
GeneralRe: Assignment Pin
Tomas Brennan19-Nov-07 4:53
Tomas Brennan19-Nov-07 4:53 
GeneralFor loop horror Pin
Llasus1-Nov-07 14:12
Llasus1-Nov-07 14:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.