I have two types of customers in a table, privileged and normal users. When I select some column values from the customers table I want default values for normal users whereas I need actual values for privileged users.
query:
select name,id,budget,employees,duration from customers
where reg_date >= to_date( '01-SEP-2012','dd-mmm-yyyy')
and reg_date <= to_date('01-OCT-2012','dd-mmm-yyyy')
For normal users I need the values of budget, employees, duration columns as 0.
I have to query another table by ‘id’ and ‘reg_mode’ to check if a user is privileged user or not. I may be advised that I should have a column in customers table to include ‘type’ of the customer. Unfortunately I am not authorized to modify the tables. Any ideas to pull the values with lesser latency?
Not sure if I got it, specially because the tables structure is not so clear…
Lets suppose the other table name is user_type. I suppose what you want is (note my query can have minor errors since I didn’t try, I just want to give an idea of the structure):
Inner join is similar to where, please let me know if you have questions regarding that terminology…