"Marc Gravell" <marc.gravell@g mail.comwrote in message
news:7981a025-7a58-43f1-b260-5f457fd5f10a@v4 g2000hsf.google groups.com...
Erm, loop?
>
string[] array = { "A", "B", "C" };
for(int i = 0; i < array.Length; i++)
for (int j = 0; j < array.Length; j++)
{
Console.WriteLi ne("{0},{1}", array[j], array[i]);
}
>
You could do something more exciting, but that should do...
>
Marc
"Marc Gravell" <marc.gravell@g mail.comwrote in message
news:7981a025-7a58-43f1-b260-5f457fd5f10a@v4 g2000hsf.google groups.com...
Erm, loop?
>
string[] array = { "A", "B", "C" };
for(int i = 0; i < array.Length; i++)
for (int j = 0; j < array.Length; j++)
{
Console.WriteLi ne("{0},{1}", array[j], array[i]);
}
>
You could do something more exciting, but that should do...
>
Marc
Well, in SQL, you don't have to explicitly state CROSS JOIN anymore (and
I do believe it is actually not recommended now, but I'd have to look that
up), you can just do:
>
select
a1.AlphabetLabe l as A1Label, a2.AlphabetLabe l as A2Label,
case a1.AlphabetLabe l when a2.AlphabetLabe l then 0 else 1 end as NotSame
from
Alphabet as a1, Alphabet as a2
>
CROSS JOIN was introduced in SQL-92 to solve some ambiguity problems with
the comma notation and increase clarity (before this you couldn't use them,
so it's not a case of "not having to state it anymore"; the comma notation
came first). I'm not aware of any explicit recommendation for or against,
and either syntax will work fine.
However, it's still a very good idea to write out the CROSS JOIN explicitly,
since it's the most uncommon form of join (even if it's the most natural
one, mathematically speaking) and alerting your fellow developer to its use
is a good idea. An "accidental " cross join is not a good thing to have (as
even moderately-sized tables will produce enormous result sets) which is
exactly why ANSI SQL introduced explicit syntax for them.
Comment