Hi all.
I'm new at this with JOIN AND AS and sow on, sow here i'am with my problems.
The thing i need help with to list my values in the right ORDER
but the problem is that i have 2 tabels i get values from and i want to order by a vots from many diffrent voters.
my tabels look like this
Tabel: userlogbook
rows.
ID
lbkownerID
adminlevel
lbktopic
lbkpost
showlbk
lbktimestamp
Tabel: logbook_log
rows.
ID
lbkID
lbkownerID
lbkvisitorID
lbkvisitorview
lbkpoll
lbkvisitorstamp
Step 1.
Match ID with lbkID sow it is matches
Step 2.
Make a SUM on all inserts in row lbkpoll where row lbkID,lbkownerID AND lbkvisitorID matches
Step 3.
Liste right values after the right SUM.
i have manage to make something like this sow far but it was just i ges and it dosent work.
I have tryed to read the help on http://www.mysql.com regarding JOIN but i dident find any like my senarios sow it dident help with that 🙁.
<?php
$sql = "SELECT userlogbook.*,logbook_log.*, SUM(logbook_log.lbkpoll) AS lbkpoll_tot FROM userlogbook LEFT JOIN logbook_log ON userlogbook.ID = logbook_log.lbkID WHERE userlogbook.showlbk='yes' ORDER BY lbkpoll_tot DESC";?>
(