Identify Records Behind a Page and Subpage

Your rating: None Average: 5 (1 vote)

Use the following query to get records behind not only the page but sub-pages on a page.

WITH my_data AS
     (SELECT   subpnlname
          FROM pspnlfield
         WHERE pnlname = :1 AND subpnlname <> ' '
      GROUP BY subpnlname)
SELECT   recname
    FROM pspnlfield, my_data
   WHERE pnlname = :1 OR pnlname = my_data.subpnlname
GROUP BY recname;

Same query as above but written differently (suggested by a colleague of mine):
SELECT   recname
    FROM pspnlfield a
   WHERE pnlname = :1
      OR EXISTS (
            SELECT 'x'
                FROM pspnlfield b
               WHERE pnlname = :1
                 AND subpnlname <> ' '
                 AND a.pnlname = b.subpnlname)
GROUP BY recname;

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!

Comments

Have a question? Please ask it on the forum instead.
kpstechie's picture
User offline. Last seen 1 year 22 weeks ago. Offline
Joined: 02/18/2009
Posts: 2
Re: Identify Records Behind a Page and Subpage

This Query has helped me a lost...thanks

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
The question below is to prevent automated spam submissions.
8 + 11 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.