Circuit analysis to obtain the gain of an inverting Op-Amp
In your circuit you forgot to mark non-inverting terminal to ground.  The inverting terminal is therefore at ground too. 
No current flows into opamp. So at inverting node, apply KCL/nodal analysis :

$$\frac{V_{in}}{R_1}= -\frac{V_o}{R_2}$$
$$V_o =-V_{in} \frac{R_2}{R_1}$$