When I write below query, it returns all time different sets.
SELECT title, content FROM Stack
INNER JOIN Overflow ON Stack.OverflowId = Overflow.Id
For example;
desired result:
title content
_____ _______
a - c1
b - c2
c - c3
d - c4
e - c5
f - c6
g - c7
First run:
title content
_____ _______
g - c7
d - c4
c - c3
b - c2
f - c6
e - c5
a - c1
Second run:
title content
_____ _______
d - c4
a - c1
f - c6
b - c2
g - c7
e - c5
c - c3
This is reality interesting for me..
Do you know the reason?
When I use below query it is OK.
SELECT title, content FROM Stack
INNER JOIN Overflow ON Stack.OverflowId = Overflow.Id
ORDER BY Stack.Id
But the question is
Why do I need
ORDER BYto get desired result?
You cannot expect predictable order without ORDER BY. Without it you do not have control over in which order rows are returned. Reason lies in how SQL language is specified.