all you coders out there

using C# and MSSQL here's the longest SQL statement i've ever seen.

This is in my project but my teacher did it and i still need to understand it although ofcourse i know what's the result supposed to be

myCommand.CommandText = "SELECT TBLTEMP.clan_name FROM (SELECT Clans.clan_id, Clans.clan_name, Clans.clan_tag, Clans.clan_site, Clans.clan_channel, Clans.clan_country, Clans.clan_password, CupsandClans.cup_id, CupsandClans.clan_id AS Expr1 FROM Clans INNER JOIN CupsandClans ON Clans.clan_id = CupsandClans.clan_id) AS TBLTEMP INNER JOIN Cups ON Cups.cup_id = TBLTEMP.cup_id WHERE cup_name = '" + cmbCupNames.Text + "'";

It's choosing the team names that signed up for a cup btw =D
Comments
13
ask arni :D
i pwn u with my visual basic knowlage!
I know much longer ones :D
one statement per row is a good thing to do
I already practise C# but it's a realy hard SQL expression, try google to help you.
AS TBLTEMP INNER JOIN
AS Expr1 FROM Clans INNER JOIN

try to translate this expression, go on a site web and check what mean these expressions
It's understandable...
You make cuppages at school btw? xD
Only thing we are doing is making some kind of bankstroker webpage :/
we have to do a project

and i decided to make something like clanbase =d
Parent
Why not use "SELECT *"? ;O)
I wrote longer SQL statements... Smth like... 50 lines, but with neat indenting, not everything compressed together....
if you don't understand that select you really should work on your SQL knowledge ;p

N:N relation between cups and teams represented by a table "Cupsandclans". It's simple inner join between three tables, just wrote really messy and with no formatting.
True just use a 3rd table to break the N:N relationships was my first thought too ;-)
Parent
lol i know that i have the N:N realtionship, i made the tables & relationships nP

soz late reply =o
Parent
Back to top