I have created two tables. One table called Person has the columns personid(PRIMARY KEY) and name. Another table has the columns numid(PRIMARY KEY), personid(FOREIGN KEY) and num1-num5. Now, each person can input any number of their liking, and their row of five numbers correspond with their personid. My goal is to create code that will select a random number from a pool of numbers of let's say, 4 people. I have the following code:
SELECT num1,num2,num3,num4,num5 FROM Project.numberlist
ORDER BY RAND ()
LIMIT 1
the code works but it would output a random row. my output is:
[('12', '15', 23, 54, 7)]
How would I design the code where it would output only one number. For this example, it would randomly output one number like 23 or 15 instead of the whole row
Aucun commentaire:
Enregistrer un commentaire