|
Posted by Rik on 07/22/07 11:17
On Sun, 22 Jul 2007 07:46:10 +0200, zach <wackzingo@gmail.com> wrote:
> Hi,
>
> I'm struggling to figure something out. What I have are thousands of =
=
> questions from 5 books of the bible in a database. The questions are =
> labeled with the book name, chapter, verse and type of question as =
> follows: X, B, G, A, M, R. I need to be able to select 11 questions of=
=
> the G type, 5 of A, 1 M, 1 R, 1 X, AND 1 B. I need to select them all =
=
> randomly and display them randomly. I want to give user the option to =
=
> change the range of books and chapter from which the questions are dra=
wn =
> from and the number of each type they want.
>
>
> I have this mysql code:
>
> "SELECT * FROM questions WHERE book IN ('Galatians', =
> 'Ephesians','Philippians') AND chapters IN ('G1', 'G2', 'G3', 'E1', =
> 'E5', 'P1') type=3D'G' ORDER BY RAND() LIMIT 11)"
Are you sure? I miss an ' AND ' before 'type'?
It should work IMHO, if it doesn't, ask in comp.databases.<name of your =
db>
-- =
Rik Wasmus
[Back to original message]
|