I'm trying to make a SELECT query that lists all actions table (but shows bookid as bookname) gets bookname from books table by bookid that comes from actions table. Cant figured out how to make it.
Here is my 2 tables:
CodePudding user response:
fixed, thanks
SELECT actions.actionid, books.bookname, actions.userid, actions.actiontype, actions.actiontype, actions.actiondate
FROM books INNER JOIN actions ON books.bookid = actions.bookid;
CodePudding user response:
SELECT action.actionid, action.userid, action.actiontype, action.actiondate, book.bookname FROM [action] INNER JOIN book ON action.bookid = book.bookid;