Hello, i hope someone can tell me what I'm doing wrong, I learned all by myself trough trying and testing, so please if I could do something better then tell me!
I am trying to Programm a filter, but I stuck with my logic
If I do it without brackets, it gives wrong Results, if I do it with brackets it gives no Results back :S
I made, some pictures of the problem, on the last picture is the Statement with and without brackets..
http://www.file-upload.net/download-8527621/problem.zip.html
edit ( text version ) :
I've a table:
marketplace_properties_used
id | id_marketplace | id_marketplace_properties_label | id_marketplace_properties | value
1 | 10 | 3 | 0 |
2 | 10 | 6 | 35 |
4 | 10 | 10 | 22 |
5 | 10 | 9 | 0 |
6 | 11 | 3 | 0 |
7 | 11 | 6 | 5 |
8 | 11 | 7 | 7 |
9 | 11 | 7 | 10 |
10 | 11 | 10 | 21 |
11 | 12 | 3 | 0 | verschenke xD
12 | 12 | 6 | 5 |
13 | 12 | 7 | 8 |
14 | 12 | 7 | 9 |
15 | 12 | 10 | 21 |
16 | 13 | 3 | 0 | verschenke haha
17 | 13 | 6 | 35 |
18 | 13 | 7 | 7 |
19 | 13 | 7 | 8 |
20 | 13 | 10 | 20 |
so, when I do the first statement:
SELECT `id_marketplace` FROM `marketplace_properties_used` WHERE (`id_marketplace_properties_label` = 7 AND `id_marketplace_properties` = 7 )
Result ( like it should be ) :
11, 13
now I want to add another filter for more properties ( I tried like this but not working ) :
SELECT `id_marketplace` FROM `marketplace_properties_used` WHERE (`id_marketplace_properties_label` = 6 AND `id_marketplace_properties` = 5 ) OR
(`id_marketplace_properties_label` = 6 AND `id_marketplace_properties` = 35 ) AND
(`id_marketplace_properties_label` = 7 AND `id_marketplace_properties` = 7 )
but it's result is 11,12 instead of 11, 13
then I tought maybe the brackets:
SELECT `id_marketplace` FROM `marketplace_properties_used` WHERE ((`id_marketplace_properties_label` = 6 AND `id_marketplace_properties` = 5 ) OR
(`id_marketplace_properties_label` = 6 AND `id_marketplace_properties` = 35 )) AND
(`id_marketplace_properties_label` = 7 AND `id_marketplace_properties` = 7 )
but this is an empty result..
it should be 11, 13 again
I dont know what to do anymore :S
I hope someone can help me here !
Edited 2 time(s). Last edit at 01/23/2014 04:30PM by Sebastian Maur.