ho questo schema PHP MySQL come rapporto tre tabelle che mostrano le uscite da tabelle diverse
Quello che voglio fare è avere questa uscita:
Come si riesce a fare la query di questo ?
Ho questo codice
SELECT users.firstname, users.lastname,
users.screenname, posts.post_id, posts.user_id,
posts.post, posts.upload_name,
posts.post_type, posts.date_posted
FROM website.users users
INNER JOIN website.posts posts ON (users.user_id = posts.user_id)
ORDER BY posts.pid DESC
//PROBLEM with this one is that it only views the post from all users.
//SO I added
SELECT COUNT(user_id) AS friends, SUM(user_id = ?) AS you, user_id
FROM feeds WHERE post_id = ?
//This one will give you two fields containing how many different users **feeds** the
post
Si prega di aiutare i ragazzi. In realtà questo sto seguendo solo lo di Facebook "LIKE" status l'unica cosa è che non sono un dilettante con questo genere di cose quindi sarei felice di sentire tutte le tue risposte. Ho davvero bisogno del vostro aiuto
Ringrazia molto compagno! Ma fratello, su questa riga "SUM (user_id =?) COME tu, - mi è piaciuto questo? GROUP_CONCAT (user_id)" dovrebbe essere "feeds.user_id"? Ho un errore che dice: "Colonna user_id nella lista dei campi è ambigua –
Sì, mi dispiace:' feeds.user_id'. Aggiornato – eggyal
Grazie mille ragazzi per tutto il vostro aiuto! –