Oh Great Dann (mySQL question)

Want to sound off, piss off or otherwise be an ass. Want to discuss non-tech and non-linux related things? This is the forum for you. Be advised, there is little moderation here and you must come with a thick skin! It's all in good fun!

Moderators: snarkout, Patrick, dann

Post Reply
jelkimantis
Posts: 24
Joined: Wed Apr 30, 2008 9:19 pm

Oh Great Dann (mySQL question)

Post by jelkimantis » Thu Jun 17, 2010 9:57 am

so I have written a join:

Code: Select all

SELECT telegrams.*, telegramMeta.* FROM telegrams
	 JOIN telegrams ON telegrams.id = joinMeta.telegramID
	 JOIN telegramMeta on joinMeta.metaID = telegramMeta.id
from our conversation years ago, this should work. Well, it didn't... So I did a little looking and wrote:

Code: Select all

SELECT telegrams.*, telegramMeta.* FROM telegrams as T1, telegramMeta as T2
	 JOIN telegrams ON telegrams.id = joinMeta.telegramID
	 JOIN telegramMeta on joinMeta.metaID = telegramMeta.id
but it complains about joinMeta.telegramID not existing. So I wrote:

Code: Select all

SELECT telegrams.*, telegramMeta.* FROM telegrams as T1, telegramMeta as T2
	 JOIN T1 ON T1.id = joinMeta.telegramID
	 JOIN telegramMeta on joinMeta.metaID = telegramMeta.id
and it complains about T1 not existing, which is fine because presumably the previous SQL statement liked telegrams, so I just returned to that statement. Any idea as to why it doesn't like joinMeta.telegramID?

U R still my hero, btw.

jelkimantis
Posts: 24
Joined: Wed Apr 30, 2008 9:19 pm

Re: Oh Great Dann (mySQL question)

Post by jelkimantis » Thu Jun 17, 2010 10:27 am

ignore me, I'm stupid:

Code: Select all

SELECT telegrams . * , telegramMeta . * 
FROM  `telegramMeta` 
JOIN  `joinMeta` ON  `telegramMeta`.`id` =  `joinMeta`.`metaID` 
JOIN  `telegrams` ON  `joinMeta`.`telegramID` =  `telegrams`.`id`
and I don't need a join, necessarily. But I think I might have made things harder than they need to be.

Post Reply