How can I create a calculated field for this table?
P粉425119739
P粉425119739 2023-09-07 13:52:18
0
1
551

SELECT book.BookTitle, author.Name, author.Surname, book.YearofPublication
FROM book
    LEFT JOIN author ON book.AuthorID = author.AuthorID;

Enter image description here

This is my current table, I need to create a calculated field to tell me how many years this book has been published, but my brain is broken. Can anyone help?

I tried using xaamp query but didn't see the option.

P粉425119739
P粉425119739

reply all(1)
P粉288069045

Try this:

SELECT book.BookTitle, author.Name, author.Surname, book.YearofPublication , YEAR(NOW()) - book.YearofPublication
FROM book
LEFT JOIN author ON book.AuthorID = author.AuthorID;
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!