I have a question how to have two JOINs using the same table.
The previous sentence probably doesn't make sense, so let me try to explain using an example. Let say, I have two tables
Now, when I want buyer information for all transactions where the price was greater than 10, I could retrieve this using the following statementCode:CREATE TABLE users (
userid INTEGER AUTO_INCREMENT,
name VARCHAR(36),
PRIMARY KEY (userid)
)
CREATE TABLE transactions (
transactionid INTEGER AUTO_INCREMENT,
buyerid INTEGER,
sellerid INTEGER,
price INTEGER,
PRIMARY KEY (transactionid)
)
But what statement should I use when I also want to retrieve the sellers name with the same query?Code:SELECT
users.name AS buyer
FROM
transactions INNER JOIN users
ON transactions.buyerid = users.userid
WHERE
transactions.price > 10

