SQL Gurus:
Q: There are 3 tables (A,B,C) with 'price' column (for the product) in each, but all tables need not have row for the product.
My requirement is as following:
1. I need to check if that row is present in 'A', pick that price and ignore rest of the tables
2. If row is not present in 'A', check to see if it is in 'B' and get the price (ignore price in 'C')
3. If row is not in 'A' and 'B', get the price from 'C'.
How can I achieve it single SQL statement?
I need generic SQL statement.
Thanks for your valuable time.
- Deep.
Q: There are 3 tables (A,B,C) with 'price' column (for the product) in each, but all tables need not have row for the product.
My requirement is as following:
1. I need to check if that row is present in 'A', pick that price and ignore rest of the tables
2. If row is not present in 'A', check to see if it is in 'B' and get the price (ignore price in 'C')
3. If row is not in 'A' and 'B', get the price from 'C'.
How can I achieve it single SQL statement?
I need generic SQL statement.
Thanks for your valuable time.
- Deep.