Home | Community | Message Board

MushroomMan Mycology
This site includes paid links. Please support our sponsors.


Welcome to the Shroomery Message Board! You are experiencing a small sample of what the site has to offer. Please login or register to post messages and view our exclusive members-only content. You'll gain access to additional forums, file attachments, board customizations, encrypted private messages, and much more!

Shop: Kraken Kratom Red Vein Kratom   PhytoExtractum Maeng Da Thai Kratom Leaf Powder

Jump to first unread post Pages: 1
OfflineGypsy Boy
Redeemer
Male


Registered: 03/17/17
Posts: 4,501
Loc: Deep in the discoteka
Last seen: 3 months, 12 days
WTF is wrong with my SQL query ???
    #26498344 - 02/22/20 11:36 AM (3 years, 11 months ago)

Im doing simple JOIN queries and i cant get past this example





Check a example how it should be done:

https://www.w3schools.com/sql/sql_join_inner.asp

SQL INNER JOIN Keyword
The INNER JOIN keyword selects records that have matching values in both tables.

INNER JOIN Syntax

SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name = table2.column_name;


As you can see it identical to mine, the WTF is wrong??????? Is this a bug on side of SQL manager?


--------------------





Extras: Filter Print Post Top
OfflineGypsy Boy
Redeemer
Male


Registered: 03/17/17
Posts: 4,501
Loc: Deep in the discoteka
Last seen: 3 months, 12 days
Re: WTF is wrong with my SQL query ??? [Re: Gypsy Boy]
    #26498347 - 02/22/20 11:38 AM (3 years, 11 months ago)

Any help much appreciated

But i think proper way of doing this is going on reddit ...


--------------------





Extras: Filter Print Post Top
Offlinedogtomato
Stranger
Registered: 09/25/19
Posts: 3
Last seen: 2 years, 11 months
Re: WTF is wrong with my SQL query ??? [Re: Gypsy Boy]
    #26498350 - 02/22/20 11:41 AM (3 years, 11 months ago)

It's telling you "ambiguous" because the field name exists in both tables. You need to specify the field name - SELECT messages.forum_id FROM messages (etc.)


Extras: Filter Print Post Top
OfflineGypsy Boy
Redeemer
Male


Registered: 03/17/17
Posts: 4,501
Loc: Deep in the discoteka
Last seen: 3 months, 12 days
Re: WTF is wrong with my SQL query ??? [Re: dogtomato]
    #26498366 - 02/22/20 12:00 PM (3 years, 11 months ago)

I dont get this:

I typed out the example EXACTLY as it appears in the book i got.

I tried 

SELECT messages.forum_id FROM messages

It seems to work but i dont get it why. Like i said i typed it out exactly as appears in the book.

Why say "SELECT messages.forum_id" and then add FROM messages, why select messages.forum_id when i say FROM table messages already??? 


Anyway thanks for the help dude


--------------------





Extras: Filter Print Post Top
OfflineGypsy Boy
Redeemer
Male


Registered: 03/17/17
Posts: 4,501
Loc: Deep in the discoteka
Last seen: 3 months, 12 days
Re: WTF is wrong with my SQL query ??? [Re: Gypsy Boy]
    #26498368 - 02/22/20 12:01 PM (3 years, 11 months ago)

And what do u mean by field name?


--------------------





Extras: Filter Print Post Top
OfflineGypsy Boy
Redeemer
Male


Registered: 03/17/17
Posts: 4,501
Loc: Deep in the discoteka
Last seen: 3 months, 12 days
Re: WTF is wrong with my SQL query ??? [Re: Gypsy Boy]
    #26498375 - 02/22/20 12:08 PM (3 years, 11 months ago)

i think theres a typo in the book :doublefacepalm:


--------------------





Extras: Filter Print Post Top
OfflineGypsy Boy
Redeemer
Male


Registered: 03/17/17
Posts: 4,501
Loc: Deep in the discoteka
Last seen: 3 months, 12 days
Re: WTF is wrong with my SQL query ??? [Re: Gypsy Boy]
    #26498393 - 02/22/20 12:25 PM (3 years, 11 months ago)

I think i got it

That example IS an error example!!!

:facepalm:


--------------------





Extras: Filter Print Post Top
Offlinedogtomato
Stranger
Registered: 09/25/19
Posts: 3
Last seen: 2 years, 11 months
Re: WTF is wrong with my SQL query ??? [Re: Gypsy Boy]
    #26498581 - 02/22/20 02:36 PM (3 years, 11 months ago)

Yeah, and I get why it's confusing - you are saying "FROM messages" so in english it makes sense to think that's the only thing you're selecting FROM. But the way joins work is that you're actually joining two tables together - so what SQL sees is "SELECT .... FROM [messages INNER JOIN forums]" where the object you're selecting from is the two tables joined together as one. Hope that makes sense.


Extras: Filter Print Post Top
Offlinedogtomato
Stranger
Registered: 09/25/19
Posts: 3
Last seen: 2 years, 11 months
Re: WTF is wrong with my SQL query ??? [Re: dogtomato]
    #26498586 - 02/22/20 02:38 PM (3 years, 11 months ago)

Also, some people say fields, some people say columns... fields is less specific. A column is a field, but a field could be a column or a formula using columns... that's a whole other can 'o worms!


Extras: Filter Print Post Top
Jump to top Pages: 1

Shop: Kraken Kratom Red Vein Kratom   PhytoExtractum Maeng Da Thai Kratom Leaf Powder


Similar ThreadsPosterViewsRepliesLast post
* sql getting started strangladesh 830 15 11/29/06 12:04 PM
by tak
* I need help wiring a 12v dc SQL cage fan SteakNMushVroom 3,891 19 12/14/09 03:05 AM
by SteakNMushVroom
* man...wtf...computer question Cubieman420 1,846 16 07/28/03 10:29 AM
by wingnutx
* webmasters HELP ( php ) ChromeCrow 714 3 09/08/03 07:47 AM
by Seuss
* my simple programming questions thread (javascript + html) stefan 716 3 04/28/08 04:43 PM
by stefan
* WTF?? Joshua 992 8 01/25/03 11:07 AM
by Aneglakya
* WTF???? SkorpivoMusterion 598 3 03/19/03 09:28 PM
by zeronio
* DCC pending...wtf??? Cubieman420 724 2 02/26/03 07:18 AM
by Cubieman420

Extra information
You cannot start new topics / You cannot reply to topics
HTML is disabled / BBCode is enabled
Moderator: trendal, automan, Northerner
326 topic views. 0 members, 0 guests and 1 web crawlers are browsing this forum.
[ Show Images Only | Sort by Score | Print Topic ]
Search this thread:

Copyright 1997-2024 Mind Media. Some rights reserved.

Generated in 0.022 seconds spending 0.004 seconds on 12 queries.