Results 1 to 3 of 3

Thread: Filtering query

  1. #1
    Join Date
    Jan 2009
    Posts
    124

    Unanswered: Filtering query

    This query produces a list of names(RESULTS) which correctly includes two parent(s) by virtue of the union. What I need now is to eliminate the name "Kids" from RESULTs because "Kids" are replaced by the two name_mnu results.

    Logic: List all "parent" and all "name_mnu" (as parent) but filter out and parent whose name_mnu is not null. See attachment:

    This will be a menu list of pages (parent) where if the page has
    Query:

    SELECT name_mnu
    FROM menu m1
    WHERE name_mnu IS NOT NULL
    UNION
    SELECT parent
    FROM menu m2
    WHERE name_mnu IS NULL
    ORDER BY name_mnu

    RESULTS:

    About
    Contact
    Education
    Entertainment
    HOME
    Kid's Place
    Kids
    Login
    Press Room
    Sponsors
    Ticket/Events
    Trash art


    Nick
    Attached Thumbnails Attached Thumbnails Screen shot 2010-01-23 at 9.11.17 AM.png  

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    nick, i was gonna give your query a try, and then i took a look at your data

    something seems really, really wrong

    could you please explain the purpose of each column
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2009
    Posts
    124
    The Results list is is a list of pages in a menu system for a web site. In the attachement you can see that KIDS (on parent) has two subordinate items which are sub-menu items. I need a list of all of parent where name_mun IS NULL, and all of name_mnu where name_menu IS NOT NULL, ordered alphabetically.

    So RESULTS which not have KIDS and I would like to name the resulting column "CSSMENU".

    Nick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •