hi all. below is my code. what i want is the financial_year_end to return only year instead of yyyy-mm-dd format. can anyone show me how can i do that? many thanks in return :)

SELECT a.stock_code, a.financial_year_end, current_name, board_name, sector_name, sub_sector_name, e.year_id, (receivable*365/revenue) AS "totaldso"
FROM qiddb.company_info a
LEFT JOIN ref_board b ON (b.board_code=a.board_code)
LEFT JOIN ref_sector c ON (c.sector_code=a.sector_code)
LEFT JOIN ref_sub_sector d ON (d.sub_sector_code=a.sub_sector_code)
LEFT JOIN company_financial e ON(e.stock_code=a.stock_code)
WHERE b.board_code='am' AND e.year_id = '2009'

thank you BlurrieBlue for the reference. :)

i've found easier solution to get ,year or month from a date.

SELECT YEAR(financial_year_end)
FROM company_info

with this code, it will return only year of the date.

Be a part of the DaniWeb community

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