sql query with combination of row values [message #656806] |
Wed, 19 October 2016 13:44 |
|
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 #656808 is a reply to message #656807] |
Wed, 19 October 2016 13:57 |
|
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 #656829 is a reply to message #656808] |
Thu, 20 October 2016 03:09 |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
gorants wrote on Wed, 19 October 2016 19:57Sorry 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.
|
|
|