Jump to content

Not unique table/alias: 'produkter'


rootKID

Recommended Posts

this is my SQL:

SELECTprodukter.p_id,produkter.p_titel,produkter.p_kunstner,produkter.p_oprettet,image_url.img_url,genre.g_navn,priser.pr_prisFROMprodukter  INNER JOIN produkter ON produkter.p_FK_pris = priser.pr_id  INNER JOIN image_url ON image_url.img_FK_products = produkter.p_id  INNER JOIN genre ON produkter.p_FK_genre = genre.g_id

and i cannot see what the heck is wrong... ideas?...and how to fix ect Oo...

Link to comment
Share on other sites

hello, and sorry for late reply,... as useally... but JSG... i agree that i have to give them aliases... but i cannot just type (produkter AS p)... right?... or am i wrong :P.. anyways... i just really need this one to work, and i have no clue on what to do from now on here... or, at least with this peace of junk SQL :P...ideas?... i mean, i was trying to use (SQL-FlySpeed) Program to make the SQL start for me... faster, and easier when im to the exams...then i can cut some time and spend more of the time to the coding part :P... but about the code, i was trying to make with flyspeed, and instead of (produkter) then it said (genre)... and i could not do a damn thing....because its a shop-kind of website we are going to make... so i need to take from the (produkter/shop) table... ideas?... EDIT: and yes... i can see where the thing is going wrong... but to make a innerjoin, then i (need) to write a table first (INNER JOIN table)... right?...

Edited by rootKID
Link to comment
Share on other sites

SQL:

SELECTprodukter.p_id,produkter.p_titel,produkter.p_kunstner,produkter.p_oprettet,image_url.img_url,genre.g_navn,priser.pr_pris,produkter AS pFROMp  INNER JOIN produkter ON produkter.p_FK_pris = priser.pr_id  INNER JOIN image_url ON image_url.img_FK_products = produkter.p_id  INNER JOIN genre ON produkter.p_FK_genre = genre.g_id

Gives: Table 'svende_prove.p' doesn't exist... that is why...:/...

Edited by rootKID
Link to comment
Share on other sites

Well, if you did it correctly, then it would work. Yeah, it's not going to work if you don't do it right. Why do you have the table alias in the list of fields to select? It's not a field, it's a table. SELECTp1.p_id,p1.p_titel,p1.p_kunstner,p1.p_oprettet,image_url.img_url,genre.g_navn,priser.pr_prisFROMprodukter AS p1INNER JOIN produkter AS p2 ...

Link to comment
Share on other sites

ohh.... crap... my bad :/... will test and give feedback... -thanks... EDIT: this is what i get.... (Unknown column 'priser.pr_pris' in 'field list')... so now its working at least... but the fun part is that i have copy/pasted from the DB itself... so i know for sure that i have (NOT) spelled wrong...ideas?... SQL:

SELECTp1.p_id,p1.p_titel,p1.p_kunstner,p1.p_oprettet,image_url.img_url,genre.g_navn,priser.pr_prisFROMprodukter AS p1  INNER JOIN produkter ON p1.p_FK_pris = priser.pr_id  INNER JOIN image_url ON image_url.img_FK_products = p1.p_id  INNER JOIN genre ON p1g.p_FK_genre = genre.g_id

Edited by rootKID
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...