Monday, 26 August 2013

MySQL query troubles

MySQL query troubles

I have this query here:
select distinct oawa_id, 'Team Impact' as Club, FirstName, LastName
from team_impacts ti
left join session_participants sp
on (sp.member_id = ti.id)
or (sp.member_id = ti.oawa_id)
order by LastName asc, FirstName asc
and this provides me with a list of users...but some users have the same
first name and last name and some come with an oawa_id and some
dont...exmaple:
Record 1. Brad May has an oawa_id Record 2. Brad May doesnt have an oawa_id
its okay if some people do not have an oawa_id, but for cases like these,
if people have the same name, get the one with the oawa_id and ignore the
one without. Thats only applys for people with the same name.
Any suggestions?

No comments:

Post a Comment