In my database I have a birthdate field, type decimal. Example of a record would be 19721003, i.e. 10/03/1972. I am using the following syntax where $whatMonth = '10'. Ulitmately, I want to pull out all the records with a birthday in a specific month, then order them by day:
SELECT lastname, altaddr1, altaddr2, altaddr4, altcntry, CONVERT(birthdate, SQL_CHAR) FROM SOINC.UPEMPL where status <> 3 CONVERT(SUBSTRING(birthdate,5,2), SQL_INTEGER) = '$whatMonth'
This is not working and I have tried CAST as well but no luck with that. I am sure it is just that I don't know the exact syntax. Any help would be great.
Red Flag Submitted
Thank you for helping keep Tek-Tips Forums free from inappropriate posts. The Tek-Tips staff will check this out and take appropriate action.
Reply To This Thread
Posting in the Tek-Tips forums is a member-only feature.