Resolved Sql ambiguous problem

Status
Not open for further replies.

Realme

Active member
Joined
Jul 2, 2019
Messages
31
Programming Experience
Beginner
Hi,

I get ambiguous error when I try to select ID how can I prevent this?

Here is the code:

SELECT DISTINCT id, title, category,year director FROM movie JOIN director ON movie.id=director.id
 

Realme

Active member
Joined
Jul 2, 2019
Messages
31
Programming Experience
Beginner
Don't worry, consider it as done
 

Skydiver

Well-known member
Joined
Apr 6, 2019
Messages
291
Location
Virginia Beach, VA
Programming Experience
10+
How is this a C# question? This looks like a basic SQL syntax problem. The SQL parser doesn't know if the id you have in the columns list refers to the id in the movie or director table.
 

Realme

Active member
Joined
Jul 2, 2019
Messages
31
Programming Experience
Beginner
How is this a C# question? This looks like a basic SQL syntax problem. The SQL parser doesn't know if the id you have in the columns list refers to the id in the movie or director table.
Correct, I needed to do "movie.id"
 

Sheepings

Senior Programmer
Joined
Sep 5, 2018
Messages
277
Location
UK
Programming Experience
10+
Shouldn't that be SELECT DISTINCT id, title, category, year, director and not SELECT DISTINCT id, title, category,year director?

Careful when writing statements, and watch your commas.
 

Realme

Active member
Joined
Jul 2, 2019
Messages
31
Programming Experience
Beginner
Of course, this site does not have a debugger. On my sublime text 3 editor it would be more clear if I would make error like that also the database itself would throw error code in that case
 

Sheepings

Senior Programmer
Joined
Sep 5, 2018
Messages
277
Location
UK
Programming Experience
10+
We have copy and paste for a reason, and it saves you on typing out your mistakes, and us needing to correct them. Just sayin'
 

Sheepings

Senior Programmer
Joined
Sep 5, 2018
Messages
277
Location
UK
Programming Experience
10+
I also fail to see how a site not having a debugger would be able to rectify whether or not your field in your own database exists or not. It's not like they are connected or anything. lol
 

Realme

Active member
Joined
Jul 2, 2019
Messages
31
Programming Experience
Beginner
Well no need to be picky tricky, just w
Writing here won't tell me what I type in wrong.

Also I typed it in on my phone that is why I didn't copy paste
 

Sheepings

Senior Programmer
Joined
Sep 5, 2018
Messages
277
Location
UK
Programming Experience
10+
You seem to be getting confused here. Lets start over. Nobody is being tricky picky anything. I am now pointing out that you are wrong.
Shouldn't that be SELECT DISTINCT id, title, category, year, director and not SELECT DISTINCT id, title, category,year director?
I showed you an error above.
Of course, this site does not have a debugger. On my sublime text 3 editor it would be more clear if I would make error like that also the database itself would throw error code in that case
You implied if this site had a debugger, you'd have noticed the error. Which is incorrect.
We have copy and paste for a reason, and it saves you on typing out your mistakes, and us needing to correct them. Just sayin'
I am advising you on how to avoid posting additional mistakes by writing out your code instead of copy and pasting it like you should be doing.
I also fail to see how a site not having a debugger would be able to rectify whether or not your field in your own database exists or not. It's not like they are connected or anything. lol
I then made the point that a debugger on this website would not make any difference since they are not connected to your database to know what tables and columns exist...
Writing here won't tell me what I type in wrong.
Yes, exactly. Thank you for proving my point. So why argue what you knew to be inevitably true. My goodness..... *sigh*
 

Realme

Active member
Joined
Jul 2, 2019
Messages
31
Programming Experience
Beginner
You seem to be getting confused here. Lets start over. Nobody is being tricky picky anything. I am now pointing out that you are wrong.

I showed you an error above.

You implied if this site had a debugger, you'd have noticed the error. Which is incorrect.

I am advising you on how to avoid posting additional mistakes by writing out your code instead of copy and pasting it like you should be doing.

I then made the point that a debugger on this website would not make any difference since they are not connected to your database to know what tables and columns exist...

Yes, exactly. Thank you for proving my point. So why argue what you knew to be inevitably true. My goodness..... *sigh*

I don't know man, check the photo.


I just woke up and I am here and I don't know what you talking of right now, I am just gonna drink my fuzetea and relax, can't really go to beach because it is too hot
 
Status
Not open for further replies.
Top Bottom