mysql call not working?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dreams4000
Forum Newbie
Posts: 9
Joined: Thu Feb 05, 2004 1:51 pm

mysql call not working?

Post by dreams4000 »

Hi all,

I am trying to do a call but can't quite seem to get it correct. I have been messing with it for a while and it partially works but one section is not working. The call is:

$tmpquery .= "WHERE (pro.status IN(0,1,2,3,4) AND pro.assigned_by = '$id') AND teams.member NOT IN($id) AND (pro.complete_date > (NOW() - INTERVAL 370 DAY) or pro.complete_date = 0) ORDER BY $block1->sortingValue";

the "AND teams.member NOT IN($id)" part is what doesn't seem to be working right. The current statement pulls all projects with a status in that list or assigned by $id just fine, but there is also a teams section and I dont want it pulling projects that this $id is a team member of, even if it was assigned by this $id. I guess in normal english it would be, pull all projects with these status options and the project was assigned by this id, but dont pull it if this id is also a team member. Any way to get that into mysql? Thanks so much!
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

Instead of IN how about trying simply...

Code: Select all

$tmpquery .= "WHERE pro.status IN(0,1,2,3,4) AND pro.assigned_by = '$id' AND teams.member != '$id' AND (pro.complete_date > (NOW() - INTERVAL 370 DAY) OR pro.complete_date = 0) ORDER BY $block1->sortingValue";
dreams4000
Forum Newbie
Posts: 9
Joined: Thu Feb 05, 2004 1:51 pm

Post by dreams4000 »

Tried that:( Doesn't have any effect. I think the problem might be stemming from the fact that the team member may be a team member in other projects in the table.. but I am just looking to exclude theproject from being called where the member assigned the project and is also a team member of that project.
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

What's the whole query look like?
Post Reply