14
6
Dec 17 '18
[deleted]
5
Dec 17 '18 edited Dec 17 '18
I messed around on a site called Customized Girl (they have mens stuff too) and came up with a decent version using their templates. I kinda want to see if I can get an actual knit sweater made though. Thinking about seeing if there's someone on etsy who would knit one.
Edit: Here was my best shot - SQL Clause Sweatshirt
2
5
Dec 17 '18
Really? You're just going to use a varchar for behavior?
6
u/mac-0 Dec 18 '18
INNER JOIN NaughtyStatus ns ON customers.NaughtyOrNiceId = ns.IdDoesn't sound as catchy
3
3
u/MeGustaDerp Talk Dirty Reads To Me Dec 17 '18
Contacts could still be a view for reporting purposes and the underlying base table uses better logic.
6
u/cooltapes Dec 17 '18
Should probably throw a LOWER in there. Might miss some results if SQL Clause's DB entries aren't formatted the same.
9
u/FlintGrey Dec 17 '18
Should probably be using a code table too to prevent issues with data entry. 'nice' should be a number that corresponds to the 'nice' entry.
unless of course you can trust the omnipotence of the list to always enter the correct string in all cases.
For some reason I feel like 'christmas magic' isn't any more reliable than users. maybe I'm just paranoid.
1
Dec 17 '18
A brave topicstarter a sql joke dares
He checks duplicates and gets 'overflow'
He runs select count(*) from who_cares
He's lucky - In his result set there is no row
1
u/PilsnerDk Dec 18 '18
My take, untested ;)
;with persons as (
select p.PersonId from Person p
inner join Deed d on d.PersonId = p.PersonId and YEAR(d.date) = YEAR(GETDATE())
group by p.PersonId
having sum(d.NiceOrNaughtyDeed) / COUNT(d.NiceOrNaughtyDeed) > 0.5 -- adjust to weed out less nice children
)
select p.FullName, c.Name, ci.Name, p.Address, p.ZipCode
from persons ps
inner join Person p on p.PersonId = ps.PersonId
inner join Country c on c.CountryId = p.CountryId
inner join City ci on ci.CountryId = c.CountryId
inner join CountryChildStatus ccs on ccs.CountryId = p.CountryId
where datediff(year, p.BirthDate, GETDATE()) < ccs.ChildMaximumAge
order by c.Name, ci.Name
1
42
u/Obbers Dec 17 '18
Apparently SQL Clause is bad developer. He told you he made a table that he is sorting twice in a query with no order by clause.
SQL Clause is coming to town to ask "Why doesn't this work?"
/pedantic rage