By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,867 Members | 1,964 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,867 IT Pros & Developers. It's quick & easy.

SQL Query question

100+
P: 347
I have a page here

http://www.yaketyyak.co.uk/pages/girls.asp?id=all

and a page here

http://www.yaketyyak.co.uk/pages/kids.asp?id=All

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

Expand|Select|Wrap|Line Numbers
  1. 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

Expand|Select|Wrap|Line Numbers
  1. 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

http://www.yaketyyak.co.uk/pages/girlsz.asp?id=All

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

any ideas would be appreceated
Mar 21 '13 #1
Share this Question
Share on Google+
4 Replies


Rabbit
Expert Mod 10K+
P: 12,370
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.
Mar 21 '13 #2

100+
P: 347
@Rabbit
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
Mar 22 '13 #3

100+
P: 347
I now have this page

http://www.yaketyyak.co.uk/pages/girlszz.asp?id=Teenage

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

Expand|Select|Wrap|Line Numbers
  1. 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
Mar 22 '13 #4

Rabbit
Expert Mod 10K+
P: 12,370
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.
Mar 22 '13 #5

Post your reply

Sign in to post your reply or Sign up for a free account.