This procedure was created by SQL Server and I was wondering was the code generated correct. I am not sure if the Inner Joins are correct. I am trying to select all of the accounts from the table called "tbl_Accounts" and instead of returning the ID number of each foreign key I want to return the actual data. For example
1 = Savings
2 = Checking
3 = 401K
I have included the sp and the tables below.
Thanks
Select
dbo.tbl_Accounts.Account_ID_Number,
dbo.tbl_Accounts.char_Account_Name,
dbo.tbl_Accounts.date_Account_Open_Date,
dbo.tbl_Accounts.date_Account_Closed_Date,
dbo.tbl_Accounts.int_Account_Balance,
dbo.tbl_Accounts.int_Account_Balance,
dbo.tbl_Account_Types.char_Account_Types,
dbo.tbl_Account_Status.char_Current_Status
FROM
dbo.tbl_Accounts
INNER JOIN
dbo.tbl_Account_Status ON
dbo.tbl_Accounts.Account_Status_ID_Number
=
dbo.tbl_Account_Status.Account_Status_ID_Number
INNER JOIN
dbo.tbl_Account_Types ON
dbo.tbl_Accounts.Account_Types_ID_Number
=
dbo.tbl_Account_Types.Account_Types_ID_Number
Here are the tables in the database
tbl_Accounts
----------------
Account_ID_Number
char_Account_Name
date_Account_Open_Date
date_Account_Closed_Date
int_Account_Balance
char_Account_Issuer
Account_Types_ID_Number [fk]
Account_Status_ID_Number [fk]
tbl_Account_Types
-----------------------
char_Account_Types
Account_Types_ID_Number
tbl_Account_Status
-------------------------
Account_Status_ID_Number
char_Current_Status
1 = Savings
2 = Checking
3 = 401K
I have included the sp and the tables below.
Thanks
Select
dbo.tbl_Accounts.Account_ID_Number,
dbo.tbl_Accounts.char_Account_Name,
dbo.tbl_Accounts.date_Account_Open_Date,
dbo.tbl_Accounts.date_Account_Closed_Date,
dbo.tbl_Accounts.int_Account_Balance,
dbo.tbl_Accounts.int_Account_Balance,
dbo.tbl_Account_Types.char_Account_Types,
dbo.tbl_Account_Status.char_Current_Status
FROM
dbo.tbl_Accounts
INNER JOIN
dbo.tbl_Account_Status ON
dbo.tbl_Accounts.Account_Status_ID_Number
=
dbo.tbl_Account_Status.Account_Status_ID_Number
INNER JOIN
dbo.tbl_Account_Types ON
dbo.tbl_Accounts.Account_Types_ID_Number
=
dbo.tbl_Account_Types.Account_Types_ID_Number
Here are the tables in the database
tbl_Accounts
----------------
Account_ID_Number
char_Account_Name
date_Account_Open_Date
date_Account_Closed_Date
int_Account_Balance
char_Account_Issuer
Account_Types_ID_Number [fk]
Account_Status_ID_Number [fk]
tbl_Account_Types
-----------------------
char_Account_Types
Account_Types_ID_Number
tbl_Account_Status
-------------------------
Account_Status_ID_Number
char_Current_Status