php - Get info using table Joins with 2 MySQL tables and DISTINCT -
i have 2 tables: 'bidders' , 'solditems' tables.
the solditems table has 2 columns need use: buyerid , paidstatus. in bidders table, want info columns: bidnum, bidfname, bidlname, bidphnum. (the 'buyerid' values in sold items corresponds 'bidnum' in bidders)
i'm trying unique buyer numbers solditems table paidstatus marked unpaid, , buyers' info (fname, lname, , phnum) bidders table.
this have right now:
select distinct(i.buyerid), b.bidfname, b.bidlname, b.bidphnum 'solditems' inner join 'bidders' b on i.buyerid = b.bidnum i.paidstatus='unpaid' order i.buyerid asc
if use in phpmyadmin sql section test it, error says:
1064 - have error in sql syntax; check manual corresponds mariadb server version right syntax use near ''solditems' inner join 'bidders' b on i.buyerid = b.bidnum i.paids' @ line 1
i've never done joins before can't seem working.
changed ' ` symbol columns , ' " string values
select distinct(i.buyerid), b.bidfname, b.bidlname, b.bidphnum `solditems` inner join `bidders` b on i.buyerid = b.bidnum i.paidstatus= "unpaid" order i.buyerid asc
Comments
Post a Comment