473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SQL Query question

347 100+
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
4 1349
Rabbit
12,516 Expert Mod 8TB
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
colinod
347 100+
@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
colinod
347 100+
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
12,516 Expert Mod 8TB
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

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

Similar topics

16
by: cover | last post by:
I have a form with drop down menus to query for name, month, and year to capture activity accordingly by an individual for a given month and given year. But I'd like to also be able to query ALL...
4
by: Spark | last post by:
Hi, Situation: Need a query to return number of ticket records by month of open in a log table where the ticket open record is older than 24 hours then the ticket pending or ticket closed...
3
by: MX1 | last post by:
Here's a simple query question. I have tables. One is an order table and one is an order detail table. tOrder tOrderDetail The tOrder table contains basic info like customer name, date, a...
1
by: Jaycee66 | last post by:
Access 2000 "Between" query question: I am relatively new to MS Access and everytime I think I have a basic concept of the program it pokes me in the eye with something I think would be simple to...
2
by: Erica | last post by:
Hi All, I've searched the usenet/web high and low and cant seem to find any guidelines for the query i'm trying to write. I have made a database that contains all my invoices. Invoices that...
7
by: Scott Frankel | last post by:
Still too new to SQL to have run across this yet ... How does one return the latest row from a table, given multiple entries of varying data? i.e.: given a table that looks like this: color...
3
by: cover | last post by:
I have a table with 50 fields that receive input depending on whether that input came in from a 'shaker' form or a 'conveyor' form. Input from the 'conveyor' form might populate 25 fields while...
10
by: Robert | last post by:
I am an attorney in a non-profit organization and a self-taught programmer. I'm trying to create a client db that will allow me to search for potential conflicts of interest based either on Social...
2
by: Grip | last post by:
Just started teaching myself Access and I've got a newbie question... I have two tables tblPpl and tblOrgs linked by a many-to-one relationship. I'm trying to produce a report that will show a...
3
by: bob laughland | last post by:
Hi All, I have another SQL question, and this one is going to be difficult to explain. I have a table like this rowid name changed 1 a 1 1 ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.