MySQL Forums
Forum List  »  Oracle

Help with Minus query as a view
Posted by: Jeremy Wickham
Date: December 01, 2010 10:04AM

I am migrating some data from oracle to mysql. I have created the same data structure and I have migrated the data into the tables. So my dilemma is this. We have a view that pulls the data out of the tables based on what groups they belong and if those groups are to be included/excluded from other groups.

group_members is the groups users belong to
matrix_group defines if a group should be included or excluded from another group.

create or replace view member_belongs_to_group_view (username, groupid) as
select username, c.groupid
from group_members a, matrix_group c
where a.gid in
(select member_groupid from matrix_group where groupid = c.groupid and state = 'I')
MINUS
select username, d.groupid
from group_members b, matrix_group d
where b.gid in
(select member_groupid from matrix_group where groupid = d.groupid and state = 'E')

I have been able to create 3 different views to get this to properly execute, but it takes it way to long to return any data. This query executed in oracle takes less than a second.

Options: ReplyQuote


Subject
Views
Written By
Posted
Help with Minus query as a view
3515
December 01, 2010 10:04AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.