Dropdown dependent problem

QuestionsDropdown dependent problem
Azam asked 9 years ago

Hello, Abu Gufran!
When using dropdown dependent with 'or' statement in sql query, i do not get the required (filtered) records. Can you fix it? If I will remove 'or' statement in sql query, everything is ok!

4 Answers
Abu Ghufran answered 9 years ago

Hi,

Azam, can you send me sample code snippet. Currently i am facing problem in regenerating this case.

Azam answered 9 years ago

Hi, Abu Gufran!
If you will change (for example) in your demo code for dropdown dependent query to:

$g->select_command = "SELECT id, invdate, invheader.client_id, amount, note FROM invheader
INNER JOIN clients on clients.client_id = invheader.client_id where amount=1000 or amount<500
";

you will see that it will work incorrect. The 'or' statement in that query causes abnormal result. Thank in advance!

Abu Ghufran answered 9 years ago

Change following …
where amount=1000 or amount<500

to

where (amount=1000 or amount<500)

By this, it will not interfere with the search where clause additions.

$g->select_command = "SELECT id, invdate, invheader.client_id, amount, note FROM invheader
INNER JOIN clients on clients.client_id = invheader.client_id where (amount=1000 or amount<500)
";

Azam answered 9 years ago

Thanks! It works!

Your Answer

7 + 15 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?