Khaberstroh
MIS
Good Afternoon. I am not very experiance in writing mysql statements, but I need to have a statement that I can pull data from a database and put it in an excel worksheet. I have already done all of the connecting and pulled some data but now I want to pull it in a differant way.
Heres what I got.
I have 3 tables that all have a column with a unique id called project_seq. These tables contain differant data and I want to bring some columns of data from the tables but not all of the columns and have it matched up with project_seq.
the tables are called.
pmo_project, pmo_progress, pmo_project_period_cost
From pmo_project I want this data.
project_name, project_manager, benefit_org, project_state_name
From pmo_progress I want this data.
currentyear_capital_completion_cost, currentyear_expense_completion_cost, nextyear_capital_completion_cost, nextyear_expense_completion_cost, futureyears_capital_completion_cost, futureyears_expense_completion_cost
From pmo_project_period_cost I want this data
sum(planned_cost) as 'Planned Cost', sum(actual_cost) as 'Actual Cost'
This is what I have so far, but keep getting; ambiguous column name "project_sequence"
mysql4 = "SELECT project_seq, project_name, project_manager, benefit_org, project_state_name, currentyear_capital_completion_cost, currentyear_expense_completion_cost, nextyear_capital_completion_cost, nextyear_expense_completion_cost, futureyears_capital_completion_cost, futureyears_expense_completion_cost, sum(planned_cost) as 'Planned Cost', sum(actual_cost) as 'Actual Cost' FROM pmo_project, pmo_progress, pmo_project_period_cost order by project_seq;"
Any one have some suggestions?
Heres what I got.
I have 3 tables that all have a column with a unique id called project_seq. These tables contain differant data and I want to bring some columns of data from the tables but not all of the columns and have it matched up with project_seq.
the tables are called.
pmo_project, pmo_progress, pmo_project_period_cost
From pmo_project I want this data.
project_name, project_manager, benefit_org, project_state_name
From pmo_progress I want this data.
currentyear_capital_completion_cost, currentyear_expense_completion_cost, nextyear_capital_completion_cost, nextyear_expense_completion_cost, futureyears_capital_completion_cost, futureyears_expense_completion_cost
From pmo_project_period_cost I want this data
sum(planned_cost) as 'Planned Cost', sum(actual_cost) as 'Actual Cost'
This is what I have so far, but keep getting; ambiguous column name "project_sequence"
mysql4 = "SELECT project_seq, project_name, project_manager, benefit_org, project_state_name, currentyear_capital_completion_cost, currentyear_expense_completion_cost, nextyear_capital_completion_cost, nextyear_expense_completion_cost, futureyears_capital_completion_cost, futureyears_expense_completion_cost, sum(planned_cost) as 'Planned Cost', sum(actual_cost) as 'Actual Cost' FROM pmo_project, pmo_progress, pmo_project_period_cost order by project_seq;"
Any one have some suggestions?