I have this table
mt.id, mt.otherId, mt.name, mt.myChar, mt.type
1      10            stack      U          "question"  
2      10            stack      D  
3      30            stack      U          "question"
4      10            stack      U          "whydownvotes"
And I want only rows with id 2 and 3 returned (without using the id, otherid as parameter) and ensuring name and type are matching against parameters. And when there is a duplicate otherId = then return the row with min myChar value. So far I have this :
select mt.* from myTable mt
where (mt.myChar = 'U' AND (mt.name = 'stack' AND mt.type LIKE '%question%'))
or (mt.myChar = 'D' and mt.name = 'stack')
So where otherID is 10, I want the row with min char value 'D'. I am going to need a subquery or group using min(myChar) ... ?
How do i remove the first row from the sql fiddle (without using the id):
http://sqlfiddle.com/#!9/c579a/1
edit Jeepers, whats with the downvotes, its clear question isn't it ? There is even a sql fiddle.
 
     
    