gidi: Abfrage ändern

Beitrag lesen

Hallo,

ich habe eine Frage und zwar ist es irgendwie möglich das ich folgende Abfrage so abändere, das ich die member_id nicht mehr vorgeben muss und die abfrage alle datensätze in der datenbank durchgeht??

Vielen Dank schon mal

with min_private as (
      select min(c4.private_01)
        from contact c4
       where c4.member_id=53
         and c4.contact_type_id=5
    group by c4.member_id
)
select content, MEMBER_ID
  from contact c
 where c.contact_id in (select c2.contact_id
                          from contact c2
                         where c2.member_id=53
                           and c2.contact_type_id=5
                           and c2.priority in (select min(c3.priority)
                                                 from contact c3
                                                where c3.member_id=53
                                                  and c3.contact_type_id=5
                                                  and c3.private_01 in (select * from min_private)
                                             group by c3.member_id)
                           and c2.private_01 in (select * from min_private))
   and c.contact_type_id=5