Dla bazy postgres które na pewno działa: SELECT *, (SELECT TIMESTAMP WITH TIME ZONE 'epoch' + documents.cdate * INTERVAL '1 second')::date AS datasprzed , invoicecontents.value * taxes.value AS wartoscvat FROM documents JOIN invoicecontents ON invoicecontents.docid = documents.id JOIN customers ON customers.id = documents.customerid JOIN taxes ON taxes.id = invoicecontents.taxid WHERE documents.type = 1 ORDER BY documents.cdate
Nie mam możliwości odpalenia tego na mysql ale powinno zadziałać: SELECT *, from_unixtime(documents.cdate) AS datasprzed , invoicecontents.value * taxes.value AS wartoscvat FROM documents JOIN invoicecontents ON invoicecontents.docid = documents.id JOIN customers ON customers.id = documents.customerid JOIN taxes ON taxes.id = invoicecontents.taxid WHERE documents.type = 1 ORDER BY documents.cdate