0

Hi hope someone can help me with the following

$query3 ="SELECT * FROM narr_turnier_bambini_garde UNION SELECT * FROM narr_turnier_bambini_garde_ster WHERE id_turnier_jaar = ".$idturnierjaar." order by rang, meestepunten DESC";

The WHERE clause dosn't work what i want
because it give me all the rows from both tables and column id_turnier_jaar is an id number and it is more then ones it could be shall we say 5 times with an id number 1 and some where else is the id numer about 7 times with the id number 2.

$idturnierjaar is the id number from POST from a form.

Thanks in advice JOHN

2
Contributors
2
Replies
4
Views
4 Years
Discussion Span
Last Post by johnnyd1963
3

@johnnyd1963

The WHERE clause dosn't work what i want
because it give me all the rows from both tables and column id_turnier_jaar is an id number and it is more then ones it could be shall we say 5 times with an id number 1 and some where else is the id numer about 7 times with the id number 2.

Can explain a little more about the 5 and 7 times. It wasn't very clear.

But you can try this:

$query3 ="(SELECT * FROM narr_turnier_bambini_garde WHERE id_turnier_jaar = ".$idturnierjaar." >= 5) UNION (SELECT * FROM narr_turnier_bambini_garde_ster WHERE id_turnier_jaar = ".$idturnierjaar." = 7) ORDER BY rang, meestepunten DESC";

Edited by LastMitch: grammer

1

OKE BUT i saw now what i dit wrong

i pease of your code was right

= 5 and = 7 i take it both away
it must be

$query3 ="SELECT * FROM narr_turnier_junioren_schautanz  WHERE id_turnier_jaar = ".$idturnierjaar." UNION SELECT * FROM narr_turnier_junioren_schautanz_ster  WHERE turnier_jaar=".$_POST['turnierjaarversturen']." order by rang, meestepunten DESC";

Thanks for your help it works perfect.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.