Link to home
Start Free TrialLog in
Avatar of hidrau
hidrauFlag for Brazil

asked on

Return a row from query where keys are different from other rows in the same table

Hello guys

I have a table with some rows, I need to make a query where only the row that is diferent from must be return in my query

something like this the x.codprod='A1258'


select * from table01 a
inner join table01 b on (b.xname<>a.xname and b.xcoddep<>a.xcoddep and b.xcodprod<>a.xcodprod)

it should return me

create table table01 (
xname varchar(20),
xcoddep varchar(20),
xcodprod varchar(20)
)

insert into table01 (xname, xcoddep, xcodprod) values ('alexandre', '01452', 'A1257')
insert into table01 (xname, xcoddep, xcodprod) values ('alexandre', '01452', 'A1257')
insert into table01 (xname, xcoddep, xcodprod) values ('alexandre', '01452', 'A1257')
insert into table01 (xname, xcoddep, xcodprod) values ('alexandre', '01451', 'A1258')

select * from table01

Open in new window



How to do that?
thanks
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hidrau

ASKER

thanks very very much