Return data only from one Dataset out of multiple Datasets JOINS

I have 3 tables

Table : A, B, C

Input : A JOIN B A JOIN C

Output : If i even get a single record from A JOIN B , i should completely get data from that JOIN and the second join should not be considered In such case if i get 0 records from A JOIN B then We need to extract data from A JOIN C