TITLE: Intersection of two localizations
QUESTION [6 upvotes]: Let $A$ be a commutative ring with unity. If $\mathfrak p,\mathfrak q\in \operatorname{Spec} (A)$ is it true the following equality 

$$A_\mathfrak p\cap A_\mathfrak q= A_{\mathfrak p\cup \mathfrak q }?$$

Here the symbol $A_{\mathfrak p\cup \mathfrak q }$ means the localization $S^{-1}A$, where $S=A\setminus (\mathfrak p\cup \mathfrak q)$. 
EDIT: $A$ is a domain and we can embed $A_\mathfrak p$ and $A_\mathfrak q$ in $Q(A)$.

REPLY [8 votes]: I assume that $A$ is an integral domain. As @MartinBrandenburg noticed $S^{-1}A\subseteq A_{\mathfrak{p}} \cap A_{\mathfrak{q}}$. (Here $S=A-\mathfrak{p}\cup \mathfrak{q}$.)  
Let $x\in A_{\mathfrak{p}} \cap A_{\mathfrak{q}}$. Then there is $s\in A-\mathfrak p$ and $t\in A-\mathfrak q$ such that $sx\in A$ and $tx\in A$. If $\mathfrak p\not\subseteq\mathfrak q$ and $\mathfrak q\not\subseteq\mathfrak p$, take $p\in\mathfrak p-\mathfrak q$ and $q\in\mathfrak q-\mathfrak p$. Set $u=qs+pt$. Then $u\notin \mathfrak p\cup \mathfrak q$ and obviously $ux\in A.$ It follows that $x\in S^{-1}A$. 
If $\mathfrak p\subseteq \mathfrak q$ or viceversa the equality is clear.
Remark. Using similar arguments one can prove the following:

Let $A$ be an integral domain and $\mathfrak p_1, \dots,\mathfrak p_n$ prime ideals of $A$ such that $\mathfrak p_j\not\subseteq \bigcup_{i\neq j}\mathfrak p_i$. Set $S=A-\bigcup_{i=1}^n\mathfrak p_i$. Then $S^{-1}A=\bigcap_{i=1}^nA_{\mathfrak p_i}$.