I have added a my sql query in wordpress function. now i want to get unique data from sql with highest number of "Score".
Ex: This is my SQL Table
I want 2 Results from this table in PHP.
Quiz_name Quiz_id Correct_score User_ID
KENNISMAKING 1 0 1
KENNISMAKING 1 33 1
KENNISMAKING 1 100 1
KENNISMAKING 1 33 1
KENNISMAKING 1 100 1
KENNISMAKING 1 66 1
ACTIEF VERKOPEN 7 33 1
KENNISMAKING 1 12 1
ASSORTIMENT-FRIS 15 50 1
ASSORTIMENT-FRIS 15 50 1
ASSORTIMENT-FRIS 15 25 1
ASSORTIMENT-FRIS 15 25 1
ASSORTIMENT-PSV 13 50 1
ASSORTIMENT-FRIS 15 50 1
ASSORTIMENT-PSV 13 100 1
ACTIEF VERKOPEN 7 100 1
ACTIEF VERKOPEN 7 100 1
PERSONEELSZAKEN 6 33 1
ASSORTIMENT-FRIS 15 75 1
Output: User 1 Attend Total "5" Quiz (KENNISMAKING, ACTIEF VERKOPEN, ASSORTIMENT-FRIS, ASSORTIMENT-PSV, PERSONEELSZAKEN).
(Note: Only want Number not names.)
Output: User 1 Complete 3 Quiz 100%.
raw sql. assuming the table name is quiz
SELECT count(distinct(Quiz_name)) FROM quiz WHERE User_ID == 1;
SELECT count(distinct(Quiz_name)) FROM quiz WHERE User_ID == 1 and Correct_score == 100;
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.