sql - Merge two queries into one -
i'm not sure if can in 1 query to.
i need records this:
select a.field_1, a.field_2, b.field_3, b.field_4 tbl_a a, tbl_b b a.field_1 = b.field_3
and exclude these records fall condition:
if a.field_1 in (1,2,3,4) , a.field_date < now()
update: (sorry confusion)
- so if field_1 equals 1,2,3 or 4 , has date timestamp today need display record (add results)
- and if field_1 equals 1,2,3 or 4 , has date timestamp less today (remove results).
any ideas both results 1 query
notes (if makes difference):
- field_a can have value a-z, 1-99 (two characters only)
something this?
select a.field_1, a.field_2, b.field_3, b.field_4 tbl_a a, tbl_b b a.field_1 = b.field_3 , ( case when a.field_1 in (1,2,3,4) case when a.field_date = now() 1 else 0 end else 1 end) = 1
Comments
Post a Comment