Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL JOIN

0 views
Skip to first unread message

Stuart Mueller

unread,
Mar 16, 2004, 6:01:34 AM3/16/04
to
I am not sure if this is the correct group to post to, so if its not please
forgive me and point me in the right direction.

I am in the process of creating an ASP application to read a SQL Database. I
have imported the database from an Access Database. The Database holds
Client details, such as Agent Name, Address, Telephone. etc. in a table
called Client

One of the things it needs is to have two contact names made up of title,
first name, surname and job title. So I have title_no1, firstname_no1
title_no2 etc. I have created a seperate table called Title with the fields
title_ID and title_name under title_name is such things as Mr, Mrs, etc with
a corresponding integer as title_ID, then in the client table in the field
title_no1 I have hte value for the title as the same intger as in the Title
table. And the same for title_no2. I have then created two relationships
with in SQL Server one between Client.title_no1 and Title.title_ID and
another between Client.title_no2 and Title.title_ID.

However I can't get it to display the correct values for the title on my ASP
Page. I have the following SQL Statement
adoRS.Open "SELECT *, Title.title FROM client INNER JOIN Title ON
Client.title_no1 = Title.title_ID OR Client.title_no2 = Title.title_ID WHERE
code='a value'"
I then try to display adoRS.fields("title").value twice, as I have two
titles
but I get no value in either text box.

Changeing hte INNER JOIN to be AND instead of OR gives me nothing at all as
if I'm getting no records back at all.

Can anybody give me any insight as to where I'm going wrong

Stu

--
A man goes to a tailor to try on a new custom-made suit. The
first thing he notices is that the arms are too long.
"No problem," says the tailor. "Just bend them at the elbow
and hold them out in front of you. See, now it's fine."
"But the collar is up around my ears!"
"It's nothing. Just hunch your back up a little ... no, a
little more ... that's it."
"But I'm stepping on my cuffs!" the man cries in desperation.
"Nu, bend you knees a little to take up the slack. There you
go. Look in the mirror -- the suit fits perfectly."
So, twisted like a pretzel, the man lurches out onto the
street. Reba and Florence see him go by.
"Oh, look," says Reba, "that poor man!"
"Yes," says Florence, "but what a beautiful suit."
-- Arthur Naiman, "Every Goy's Guide to Yiddish"


0 new messages