-3

I have a problem when I try to run this script I get the above error message. I am a rookie my level is beginner I am just trying to teach myself. What

This is my script

Select * 
from Customer, Account where customerid=8;

This is my relation

Juan Carlos Oropeza
  • 47,252
  • 12
  • 78
  • 118
HREA
  • 11
  • 1
  • 3
  • 2
    Possible duplicate of [1052: Column 'id' in field list is ambiguous](http://stackoverflow.com/questions/6638520/1052-column-id-in-field-list-is-ambiguous) – Tab Alleman Mar 03 '16 at 20:49
  • There is also a high likelihood of a poor query here. You have a cross join from customer to account. I doubt that is really what you want. You should really use the more current join syntax. https://sqlblog.org/2009/10/08/bad-habits-to-kick-using-old-style-joins – Sean Lange Mar 03 '16 at 21:01
  • Perhaps supply the `CREATE TABLE` statement for `Customer` and `Account`? – Colin Basnett Mar 03 '16 at 22:07

2 Answers2

0

You customer and account both have customerid field

You need specify what table are you refering too

Select * 
from Customer, Account 
where Customer.customerid=8;
Juan Carlos Oropeza
  • 47,252
  • 12
  • 78
  • 118
0

Because customerid appears in both tables you have to tell SQL which table you want to use, e.g.

Select *
from Customer, Account where Customer.customerid = 8

or

Select *
from Customer, Account where Account.customerid = 8
Mat Richardson
  • 3,576
  • 4
  • 31
  • 56