Sum with two indices, how to handle the condition $i\neq j$? I'm given
$$
\sum_{i,j=1, i \neq j}^{N} ij \tag 1
$$
I assume this is a short hand for
$$
\sum_{i=1}^{N}
\Bigg (
\sum_{j=1}^{N} ij 
\Bigg ) 
\qquad? \tag 2
$$
But where does $i\neq j$ belong, to the inner or outer sum?
Example with $N=2$ and $i\neq j$ in the inner sum:
\begin{align}
\sum_{i,j=1 \\i\neq j}^{2} ij
&=
\sum_{i=1}^{2}
\Bigg (
\sum_{j=1, i \neq j}^{2} ij 
\Bigg ) 
\tag 3
\\
&=\sum_{i=1}^{2}
\Bigg (
i1+i2
\Bigg )
\tag 4
\\
&=
(11+12 + 21 + 22)
\tag 5
\\
&\text{\{Now discard 11 och 22\}}\\
&=23
\end{align}
I guess the end result is correct, but I don't think my approach is correct ("Now discard"). How should I handle the condition $i\neq j$?

A simple way is to develop the square of $\sum_{i=1}^N{i}$ and to separate the two cases, $i=j$ and $i \ne j$:
$$\left(\sum_{i=1}^N {i}\right)^2 = \sum_{i,j=1}^N{ij} = \sum_{i,j=1 ; i \ne j}^N{ij} + \sum_{i,j=1; i=j}^N{ij}$$
$$ = \sum_{i,j=1; \,i \ne j}^N{ij} + \sum_{i=1}^N{i^2}$$
As
$$\sum_{i=1}^N {i} = \frac{N(N+1)}{2} $$
And
$$\sum_{i=1}^N {i^2} = \frac{N(N+1)(2N+1)}{6} $$
We get
$$ \sum_{i,j=1 ;\,i \ne j}^N{ij} = \frac{N^2(N+1)^2}{4} - \frac{N(N+1)(2N+1)}{6} = \frac{3N^4+2N^3-3N^2-2N}{12}$$
