|
|
 |
May 26th, 2005, 12:56 AM
|
#1
|
|
New Member
Join Date: May 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0
|
ASP ADO SQL Query
I'm having trouble thinking how to write a query ... i have two tables customer and contact ...they share a common element of customerID ... their is a login form based on the contactID, contactPassword within the contact table, based on that i want the contactID and customerID of contact, to display the fields of the customer table ...
Anyone keep up with that?
|
|
|
May 26th, 2005, 03:09 AM
|
#2
|
Join Date: Jul 2003
Posts: 1,848
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 114
|
Code:
SELECT contact.contactID, contact.contactPassword, customer.* FROM contact INNER JOIN customer ON contact.customerID = customer.customerID
|
|
|
May 26th, 2005, 05:37 AM
|
#3
|
|
New Member
Join Date: May 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0
|
Isnt that for all Customer ID?
What would you have to do for a particular Customer ID...

|
|
|
May 26th, 2005, 05:44 AM
|
#4
|
|
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 339
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0
|
Add:
Code:
where customerID = ...
|
|
|
May 26th, 2005, 05:53 AM
|
#5
|
|
New Member
Join Date: May 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0
|
Quote:
|
Originally Posted by D3mon
Add:
Code:
where customerID = ...
|
But thats part of the problem ...
... we input the contactID, and therefore its the corresponding customerID ... but how do we write that?
|
|
|
May 26th, 2005, 10:03 AM
|
#6
|
|
WebForumz Member
Join Date: Feb 2004
Location: Woodbridge, UK
Age: 28
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0
|
Is it this simple
Code:
SELECT
Col1,
Col2,
etc
FROM contact X
JOIN customer Y
ON x.CustomerID = y.CustomerID
WHERE X.ContactID = 'blah'
|
|
|
May 27th, 2005, 12:34 AM
|
#7
|
|
New Member
Join Date: May 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0
|
Quote:
|
Originally Posted by Trebz
Is it this simple
Code:
SELECT
Col1,
Col2,
etc
FROM contact X
JOIN customer Y
ON x.CustomerID = y.CustomerID
WHERE X.ContactID = 'blah'
|
Code:
SELECT *
FROM contact
JOIN customer
ON contact.CustomerID = customer.CustomerID
WHERE contact.ContactID = Request.form("username")
... like that?
|
|
|
May 27th, 2005, 12:39 AM
|
#8
|
|
New Member
Join Date: May 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0
|
I guess not ... doesnt return any values ....

|
|
|
May 30th, 2005, 06:30 AM
|
#9
|
|
WebForumz Member
Join Date: Feb 2004
Location: Woodbridge, UK
Age: 28
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0
|
Could you maybe explain the question a little clearer please, I can't quite understand what you need.
Cheers
|
|
|
May 30th, 2005, 06:32 AM
|
#10
|
|
Elite Veteran
SuperMember
Join Date: Jul 2003
Location: Southern UK
Age: 35
Posts: 3,133
Thanks: 28
Thanked 22 Times in 19 Posts
|
I have to say, I'm a little confused too... :S
|
|
|
June 18th, 2005, 12:12 PM
|
#11
|
|
New Member
Join Date: Jun 2005
Location: USA
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0
|
Quote:
|
Originally Posted by rob
I have to say, I'm a little confused too... :S
|
Me Too!
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
|
Nav bar query
|
Scottie |
Your Design and Layout |
10 |
June 9th, 2008 06:23 PM |
|
query about my $query
|
ziggi |
PHP |
9 |
August 10th, 2007 11:05 AM |
|
MySQL query query
|
dangergeek |
Databases |
3 |
April 12th, 2007 09:45 AM |
|
SUBSTRING in query
|
contiw |
Databases |
0 |
October 11th, 2006 04:23 PM |
|
Query
|
accessman |
Databases |
0 |
September 22nd, 2005 04:48 PM |
|