Thursday, 15 September 2011

MySQL Multiple Row Compare -



MySQL Multiple Row Compare -

i'm trying run query compare multiple rows in same table , shows me results match.

for example, info this:

+-------------+-----------+---------+------------+-------+ | activity_id | d_id | tech_id | timestamp | value | +-------------+-----------+---------+------------+-------+ | 39248078 | 1 | 1 | 2014-03-09 | 1 | | 39248079 | 2 | 1 | 2014-03-06 | 1 | | 39248082 | 3 | 1 | 2014-04-09 | 0 | | 39248085 | 1 | 2 | 2014-03-13 | 1 | | 39248088 | 3 | 2 | 2014-07-17 | 1 | | 39248091 | 1 | 3 | 2014-02-07 | 1 | | 39248093 | 2 | 3 | 2014-12-02 | 0 | +-------------+-----------+---------+------------+-------+

the goal d_ids tech_id = 3 , (tech_id = 1 or tech_id = 2). in case, result should 1 , 2 not 3.

i've looked subqueries wasn't able work. help much appreciated.

select d_id table d_id in( select d_id table tech_id=3 ) , tech_id=1 or tech_id=2

let me know if didn't work!

mysql

No comments:

Post a Comment