mardi 31 juillet 2018

Selcting Random queries from foreign table

Am trying to select specific number of Random questions from the table

Something like 3 random questions from questions table which are tagged as group_1 and two from group_3

This is my Sql command

SELECT
    questions.qid,
    tags.tag
FROM
    tag_dir tag_dir
JOIN questions ON questions.qid = tag_dir.qid
JOIN tags ON tags.id = tag_dir.tag_id
WHERE tags.id having 1 and 2
LIMIT 0,10

But i don't know how to get specific number of Random results

Here is my table structure




Aucun commentaire:

Enregistrer un commentaire