HI all
(Battled with the WORD – (probably wrong in these terms))
I have a field in an access database (DateInserted) and want to get a (DateID) field out of it.
To get the DateID field I use – Day(DateInserted)&Month(DateInserted)&Year(DateInserted) - (Unique key for date outputs as 21102004) my problem is that the & function does not work in MySQL.
The job I am busy with at the moment requires that I have this (newspaper’s website http://www.zoutnet.co.za news articles on a weekly basis – DATE IMPORTANT)
Question: how can I turn Day(DateInserted)&Month(DateInserted)&Year(DateInserted) as DateID into MySQL savy SQL
ANYONE THAT CAN HELP PLEASE, PLEASE DO SO!!!!

Got the answer!!!!


SELECT REPLACE(MAKE_SET(7,LPAD(Dayofmonth(Date),2,'0'),LPAD(month(Date),2,'0'),Year(Date)),',','')AS DateID From dateTable


it is a bit of a wired way but it works!
OUTPUT = 231104

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.