Home » SQL & PL/SQL » SQL & PL/SQL » sql query with combination of row values
sql query with combination of row values [message #656806] Wed, 19 October 2016 13:44 Go to next message
gorants
Messages: 85
Registered: May 2014
Location: ATL
Member
Hello experts,


My sql table tran looks like this


Type code actn
---- ---  ----
300   1    2
300   2    4
300   3    5
300   4    6
300   2    3
300   3    7
300   5    8

I need help to find all records with type=300 and excluding combination of type=300 and code=5 and actn=8. How can i do that?

select type,code,actn from  tran where type='300';

[Updated on: Wed, 19 October 2016 13:46]

Report message to a moderator

Re: sql query with combination of row values [message #656807 is a reply to message #656806] Wed, 19 October 2016 13:48 Go to previous messageGo to next message
pablolee
Messages: 2878
Registered: May 2007
Location: Scotland
Senior Member
type = 300 and not(code = 5 and actn = 8)


[mod-edit: bb disabled smilies in this post to prevent 8) from being converted to smiley]

[Updated on: Wed, 19 October 2016 14:48] by Moderator

Report message to a moderator

Re: sql query with combination of row values [message #656808 is a reply to message #656807] Wed, 19 October 2016 13:57 Go to previous messageGo to next message
gorants
Messages: 85
Registered: May 2014
Location: ATL
Member
Sorry for not being clear.
That is just sample i have multiple types and codes and action combinations. i am looking for excluding 2 particular combinations. ex: ( type=300 and code=5 and actn=8)


Type code actn
---- ---  ----
300   1    2
300   2    4
300   3    5
300   4    6
300   2    3
300   3    7
300   5    8
600   2    3
100   3    5
400   2    3

[Updated on: Wed, 19 October 2016 13:57]

Report message to a moderator

Re: sql query with combination of row values [message #656811 is a reply to message #656808] Wed, 19 October 2016 14:27 Go to previous messageGo to next message
John Watson
Messages: 7624
Registered: January 2010
Location: Global Village
Senior Member
What SQL have you tried so far?
Re: sql query with combination of row values [message #656821 is a reply to message #656806] Thu, 20 October 2016 01:28 Go to previous messageGo to next message
Michel Cadot
Messages: 65851
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

And still no test case despite we have asked you many times.
And still no feedback in your previous topics despite we have asked you many times.

Re: sql query with combination of row values [message #656829 is a reply to message #656808] Thu, 20 October 2016 03:09 Go to previous message
pablolee
Messages: 2878
Registered: May 2007
Location: Scotland
Senior Member
gorants wrote on Wed, 19 October 2016 19:57
Sorry for not being clear.
That is just sample i have multiple types and codes and action combinations. i am looking for excluding 2 particular combinations. ex: ( type=300 and code=5 and actn=8)
Still not clear, based on what you put in your second post, my answer would remain the same. Even considering your additional info Quote:
i am looking for excluding 2 particular combinations
the advice implied from my post is the same, i.e. add additional predicates to exclude the data that you do not want.
Previous Topic: PL/SQL Function fails without an exception
Next Topic: Interval in DBMS_JOB
Goto Forum:
  


Current Time: Wed Oct 24 01:05:56 CDT 2018