SQL Query question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • colinod
    Contributor
    • Nov 2007
    • 347

    SQL Query question

    I have a page here

    Yakety Yak is a leading Voice Over Agency based in London. We specialise in Voice Casting, Celebrity Voiceovers as well as English and International voices.


    and a page here

    Yakety Yak is a leading Voice Over Agency based in London. We specialise in Voice Casting, Celebrity Voiceovers as well as English and International voices.


    and i want to include the artist Tilly from the kids page on the girls page but only when the age of Teenage is selected on the girls page.

    the sql query for the girls page is

    Code:
    selectSQL = "SELECT * FROM celebs INNER JOIN celebsvoicetypes ON celebs.idnumber = celebsvoicetypes.celebidvoicetypes WHERE celebsvoicetypes.celebstypes ='" &voiceid& "' AND celebs.sex = 'girls' ORDER BY celebs.surname,celebs.firstname"
    Tillys individual id number is 154.

    i have tried

    Code:
    selectSQL = "SELECT * FROM celebs INNER JOIN celebsvoicetypes ON celebs.idnumber = celebsvoicetypes.celebidvoicetypes WHERE celebsvoicetypes.celebstypes ='" &voiceid& "' AND celebs.sex = 'girls' OR (idnumber like '154' AND celebsvoicetypes.celebstypes = 'Teenage') ORDER BY celebs.surname,celebs.firstname"
    which can bee seen here

    Yakety Yak is a leading Voice Over Agency based in London. We specialise in Voice Casting, Celebrity Voiceovers as well as English and International voices.


    but tilly appears on the all page which i do not want

    any ideas would be appreceated
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    What you should have is a table listing all the categories that a voice actor belongs to. Then you won't have to keep changing the SQL everytime you want to include someone else on another list.

    Comment

    • colinod
      Contributor
      • Nov 2007
      • 347

      #3
      Originally posted by Rabbit
      What you should have is a table listing all the categories that a voice actor belongs to. Then you won't have to keep changing the SQL everytime you want to include someone else on another list.
      I do have a seperate table the lists which artists are in which section, the problem i have is that the main section for each artist is called All and that is used in the kids section aswell as the girls section so i can remove her from the All section otherwise all would be fine

      Comment

      • colinod
        Contributor
        • Nov 2007
        • 347

        #4
        I now have this page

        Yakety Yak is a leading Voice Over Agency based in London. We specialise in Voice Casting, Celebrity Voiceovers as well as English and International voices.


        showing 3 of tilly when i go on it but at least she only shows up on the teenage section, cant figure out why though

        sql is

        Code:
        selectSQL = "SELECT * FROM celebs INNER JOIN celebsvoicetypes ON celebs.idnumber = celebsvoicetypes.celebidvoicetypes WHERE celebsvoicetypes.celebstypes ='" &voiceid& "' AND celebs.sex = 'girls' OR (idnumber like '154' AND '" &voiceid& "' like 'Teenage') ORDER BY celebs.surname,celebs.firstname"
        not much difference just changed an = to like

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          It would help to see the table layout and some sample data. If you're getting duplicates, that means you have Tilly in one of the tables more than once.

          Comment

          Working...