Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i have fileds YEAR and MONTH in a table and i want to create a string like "YEAR-MONTH" (2012-05 )
How can i do?
SQL SELECT
YEAR as `dat.year`,
MONTH as `dat.month`
[B.YEAR] &'-'& [B.MONTH] as `dat.timing` ????
date([B.YEAR]+[B.MONTH],'YYYYMM') as `dat.timing`, ?????
Thanks
That depends on the sql dialect of the source database. In Oracle you use two pipe symbols 'A' || 'B'. In SQL server you use the + sign iirc, 'A' + 'B'. If you're not sure, ask your local friendly database administrator.
Or, like Henric says, use a preceding load. Often so much simpler and more powerful.
The best way is to use a Preceding Load:
Load
Year,
Month,
Date(MakeDate(Year, Month),'YYYY-MM') as YearMonth;
SQL SELECT
YEAR as Year,
MONTH as Month
FROM ...
HIC
That depends on the sql dialect of the source database. In Oracle you use two pipe symbols 'A' || 'B'. In SQL server you use the + sign iirc, 'A' + 'B'. If you're not sure, ask your local friendly database administrator.
Or, like Henric says, use a preceding load. Often so much simpler and more powerful.