Solved

Ambiguous column name 'CustID'.

Posted on 2008-10-22
2
1,184 Views
Last Modified: 2013-12-07
Hello Experts,

I have 2 tables Customer and GiftCerticate both has a column name CustID

am trying to write the below query to check email and dob from Customer and this custid should exist
in giftcertificate table ...

SELECT CustID FROM Customer, GiftCertificate
WHERE Customer.CustEmail='test@test.com'  
AND Customer.CustDOB='15/10/1906'  
AND GiftCertificate.CustID = Customer.CustID


but i am getting this error
Ambiguous column name 'CustID'..

please can someone advise
thanks
0
Comment
Question by:learningnet
2 Comments
 
LVL 3

Accepted Solution

by:
Blackninja2007 earned 300 total points
ID: 22776677
SELECT customer. CustID
FROM Customer
inner join  GiftCertificate on GiftCertificate.CustID = Customer.CustID
WHERE Customer.CustEmail='test@test.com'  
AND Customer.CustDOB='15/10/1906'  


Derek
0
 
LVL 8

Assisted Solution

by:newbie27
newbie27 earned 200 total points
ID: 22776681
try this

SELECT  Customer.CustID FROM Customer, GiftCertificate
WHERE Customer.CustEmail='test@test.com'  
AND Customer.CustDOB='15/10/1906'  
AND GiftCertificate.CustID = Customer.CustID
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to recover a database from a user managed backup

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question