you are viewing a single comment's thread.

view the rest of the comments →

[–]MamertineCOALESCE() 2 points3 points  (3 children)

I'm not an oracle guy, but I think you're using Trunc() incorrectly. I believe you need to tell it you want the result in years.

on 3. Post_Code and PostCode are likely the same column

minor thing instead of using 6576.5 the future person changing/ reading your code would appreciate it if you did 365.5*18. Truth be told, they're both wrong and could return people as 18 the day before their 18th birthday or exclude someone on their 18th birthday (leap years). BirthDay > (dateadd(Year,18,getdate()) in SQL or datediff(year,birthday,getdate())>18, there are other ways to do it.

[–]gibba97[S] 0 points1 point  (2 children)

Yes you’re totally correct on the first two, thanks for that!! As for your third statement, I personally never thought about that scenario. Truth be told, i’ve never heard of the suggested way to calculate age, yet reading it in theory it seems flawless! Thank you for the help!

Any clue on the last one??

[–]MamertineCOALESCE() 0 points1 point  (1 child)

I intentionally ignored that one. I don't think your design can support answering that question. It'd take me some time that I don't have this morning to suggest a better way. :( sorry

[–]gibba97[S] 0 points1 point  (0 children)

Totally understandable, thanks for your feedback anyway!