I have the code here to join two tables. However I don't want to get the password element from the Accounts database. How could I do this?
"SELECT f.*, a.*
FROM Following as f
JOIN Accounts as a on f.followingUserID = a.id
WHERE `followingUserID` = '$acID'
There is no SQL convention for "all columns EXCEPT FOR..." -- it's either all, or you define the list by hand:
SELECT f.*,
a.col1, a.col2,
a.`col name using spaces not good`
FROM FOLLOWING as f
JOIN ACCOUNTS as a on f.followingUserID = a.id
WHERE f.followingUserID = '$acID'
Name the columns instead of retrieving them all.
Instead of a.*, :
a.ColumnName1, a.ColumnName2, etc....
If you don't want to select a password element you will need to change the a.*
to select each column individually ie
SELECT f.*, a.account_id, a.name
FROM following as f
JOIN accounts as a on f.followingUserId = a.id
WHERE followingUserID = '$acID'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.