Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I have to load some data and group by month and year. The field "SIMPLEDATE" is composed of Year-Month-Day (2015-11-30).
I need to divide this field and create two new field, YEAR and MONTH, so I can group by with this two new fields.
I have this script:
LOAD
SIMPLEDATE
count(*) as rich_totali
FROM [log.qvd]
(qvd)
group by
SIMPLEDATE
store * from log into [ogSintesi.qvd] (qvd);
_____________________________________________________________
I need something like this
LOAD
Year([SIMPLEDATE]) as YEAR,
Month([SIMPLEDATE]) as MONTH,
count(*) as rich_totali
FROM [log.qvd]
(qvd)
group by
YEAR,
MONTH,
store * from log into [ogSintesi.qvd] (qvd);
Is that SIMPLEDATE stored as text or actually stored as a date but shown in this weird format?
If it is text, you could use these:
left(SIMPLEDATE, 4) as YEAR,
mid(SIMPLEDATE, 6, 2) as Month