Mahmoud Badreddine wrote:
> I got it working , thank you.
> I only could do what I wanted to do in multisteps however. I couldn't
> figure out the nested querying , and it's bugging me.
> Here's how I issued it.
> mysql> update tableDummy set newDate=(select
> str_to_date('(concat(DayVal,".",MonthVal,".",YearVal))','%d.%m.%Y'));
That's because there is no nested querying needed here. The syntax is SET
col = newvalue. This would have worked if you'd simply left out the "select".
Also, there would be no need for STR_TO_DATE() if you use CONCAT() to put
the string in the correct form in the first place.
Try
UPDATE tableDummy
SET newDate = concat(YearVal,"-",MonthVal,"-",DayVal)
instead.
Michael
> And although I got an error, it did give all zero values for the
> date(e.g 0000-00-00)
>
> no big deal now that I have what I want, but if someone can pick out
> my error, would be greatly apreciated.
>
> On Fri, 18 Mar 2005 13:31:14 -0600, Dan Nelson <dnelson@stripped>
> wrote:
>
>>In the last episode (Mar 18), Mahmoud Badreddine said:
>>
>>>Hello,
>>>I have a table with separate integer values for the day, month and year.
>>>I would like to group them all under one field of type date.
>>>I tried a few commands but I haven't captured the right syntax yet.
>>>
>>>so if the field names are dayVal,monthVal and YearVal in talbeDummy
>>>
>>>I am doing the following
>>>select str_to_date(DayVal.MonthVal.YearVal,'%d.%m.%Y') from tableDummy;
>>
>> CONCAT(DayVal, ".", MonthVal, ".", YearVal)
>>
>>--
>> Dan Nelson
>> dnelson@stripped
>>
>
>
>