| Author |
Topic  |
|
|
muschamp
Starting Member
USA
14 Posts |
Posted - 05/13/2008 : 12:22:24
|
This is my query:
SELECT aircraft_id, maximum_speed_mph FROM us INNER JOIN rus ON us.aircraft_id = rus.aircraft_id WHERE maximum_speed_mph > ‘1000’
This is my error:
Msg 209, level 16, State 1, Line 4 Ambiguous column name ‘maximum_speed_mph’ Msg 209, level 16, State 1, Line 4 Ambiguous column name ‘Aircraft_id’ Msg 209, level 16, State 1, Line 4 Ambiguous column name ‘maximum_speed_mph’
Thanks for the help 
US Navy - We are fueled, armed, and go for launch. |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
48102 Posts |
Posted - 05/13/2008 : 12:26:21
|
SELECT {us/rus}.aircraft_id, {us/rus}.maximum_speed_mph
FROM us INNER JOIN rus
ON us.aircraft_id = rus.aircraft_id
WHERE {us/rus}.maximum_speed_mph > ‘1000’
give any one alias for column names (based on what values you want) |
 |
|
|
muschamp
Starting Member
USA
14 Posts |
Posted - 05/13/2008 : 12:32:57
|
I'm using SQL Express 2005
I tried it, but still getting error message.
Msg 102, Level 15, State 1, Liine 1 Incorrect syntax near '/'
US Navy - We are fueled, armed, and go for launch. |
 |
|
|
sakets_2000
Flowing Fount of Yak Knowledge
India
1472 Posts |
Posted - 05/13/2008 : 12:42:07
|
As indicated in the error messages,column names:-- maximum_speed_mph,Aircraft_id are common in the 2 tables used.
So specify wherever you are using these column names,as to which table you mean.
This specification can be done by prefixing the name of the table before the column. So instead of writing maximum_speed_mph,write rus.maximum_speed_mph or us.maximum_speed_mph.
|
 |
|
|
Van
Constraint Violating Yak Guru
456 Posts |
Posted - 05/13/2008 : 12:42:19
|
| It appears that the fields [aircraft_id] and [maximum_speed_mph] exist in both the [us] and [rus] tables. SQL Server doesn't know which table you want it from so you have to tell SQL Server which table to get it from. So instead of us/rus, choose us or rus (the one you want). That's what visach16 was illustrating. He didn't mean actually make it {us/rus} but to choose one. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
48102 Posts |
Posted - 05/13/2008 : 12:45:31
|
quote: Originally posted by muschamp
I'm using SQL Express 2005
I tried it, but still getting error message.
Msg 102, Level 15, State 1, Liine 1 Incorrect syntax near '/'
US Navy - We are fueled, armed, and go for launch.
i put / to use either of us or rus as i dont know which values you want either use us.column or rus.column |
 |
|
|
muschamp
Starting Member
USA
14 Posts |
Posted - 05/13/2008 : 14:11:16
|
I didn’t have a clear understanding of an INNER JOIN. I was trying to combine and compare the same data from two different tables. On the bright side you helped a newbie to get one step closer to know what he’s doing.
Thanks for the help!
US Navy - We are fueled, armed, and go for launch. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
48102 Posts |
Posted - 05/13/2008 : 14:14:33
|
quote: Originally posted by muschamp
I didn’t have a clear understanding of an INNER JOIN. I was trying to combine and compare the same data from two different tables. On the bright side you helped a newbie to get one step closer to know what he’s doing.
Thanks for the help!
US Navy - We are fueled, armed, and go for launch.
Did you get your result? Suggest you to go through JOINs in books online to get more idea. |
 |
|
|
muschamp
Starting Member
USA
14 Posts |
Posted - 05/13/2008 : 15:53:00
|
Our software engineer walked in and in lighted with how INNER JOINS work and what they are used for.
US Navy - We are fueled, armed, and go for launch. |
 |
|
| |
Topic  |
|