473,385 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to Reference Data in a different Table?

29
Here is the scanario:

Tables:

T_Physicians
fields: (pk)TaxID, PhysicianName

T_ServiceCodes
fields: (pk)Servicecode, ServiceName, Price

Mission:

Associate each TaxID to each ServiceCode, mind you, each Physician have their own Service codes that they bill.

Should I build a Query with a Criteria to find it in 1 Table or Build Separate lookup ServiceCodes table to reference each TaxID in T_Physicians table?


Help:

How do I accomplish this?
Sep 20 '08 #1
4 11080
aas4mis
97
Here is the scanario:

Tables:

T_Physicians
fields: (pk)TaxID, PhysicianName

T_ServiceCodes
fields: (pk)Servicecode, ServiceName, Price

Mission:

Associate each TaxID to each ServiceCode, mind you, each Physician have their own Service codes that they bill.

Should I build a Query with a Criteria to find it in 1 Table or Build Separate lookup ServiceCodes table to reference each TaxID in T_Physicians table?


Help:

How do I accomplish this?
If each TaxID is the same as each ServiceCode you should be able to use an inner join. If you go to your query window you should be able to open the SQL view and use:
"SELECT p.physicianname, s.servicename, s.price from T_Physicians as t inner join T_ServiceCodes as s on p.TaxID = s.ServiceCode;"
Hope this helps.
Sep 20 '08 #2
adigga1
29
If each TaxID is the same as each ServiceCode you should be able to use an inner join. If you go to your query window you should be able to open the SQL view and use:
"SELECT p.physicianname, s.servicename, s.price from T_Physicians as t inner join T_ServiceCodes as s on p.TaxID = s.ServiceCode;"
Hope this helps.
I will try this code and post the results. So basically what will occur when a particular Tax ID is entered should bring forth and reference the associated Service table?

Thanks
Sep 20 '08 #3
aas4mis
97
I will try this code and post the results. So basically what will occur when a particular Tax ID is entered should bring forth and reference the associated Service table?

Thanks
This query will return 3 related fields. Physician, Service, and Price. The common link between the two is the TaxID and ServiceCode. So everything should match up (thanks to the inner join). If you want to filter for a specific field/value add that with a where clause and use it as your "row source" in your forms. Another option is creating the query and using the field from your form as part of your WHERE clause. Hope this helps.
Sep 22 '08 #4
adigga1
29
This query will return 3 related fields. Physician, Service, and Price. The common link between the two is the TaxID and ServiceCode. So everything should match up (thanks to the inner join). If you want to filter for a specific field/value add that with a where clause and use it as your "row source" in your forms. Another option is creating the query and using the field from your form as part of your WHERE clause. Hope this helps.


Thank you again for all of your help enclosed is the SQL code of my QUERY;

what i'm trying to accomplish is this: say for example the Physician TaxID is equal to Sibley Hospital, I would like a means to automatically reference the SibleyCPT table inorder to choose my Sibley service and price....


SELECT T_Service.ServiceNumID, T_Service.TaxIDNum, T_Physicians.TaxID, T_Physicians.HospitalName, T_Service.SibleyNum, T_SibleyCpt.CPTcode, T_SibleyCpt.Charge, T_Service.ECCcptNum, T_ECCcpt.CPTcode, T_ECCcpt.Charge
FROM T_SibleyCpt INNER JOIN (T_Physicians INNER JOIN (T_ECCcpt INNER JOIN T_Service ON T_ECCcpt.ECCcptNum = T_Service.ECCcptNum) ON T_Physicians.TaxIDNum = T_Service.TaxIDNum) ON T_SibleyCpt.SibleyNum = T_Service.SibleyNum;


thank you in advance
---adigga1
Oct 2 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Will | last post by:
Hi, I have a form which calculates a final cost (frmWorkCosts, data stored in tblWorkCosts) and once calculated adds this final cost (Which isn't saved in tblWorkCosts) into a different table...
2
by: Scott Yost | last post by:
I reference a .NET DLL to import some of my custom types. I can build that DLL in debug or release mode, but I usually keep the debug one built so I can debug it. When I want to link to the release...
4
by: bdockery | last post by:
Access 2007 I have a table with three columns. Country, State, City What I want to do is have a form where the Country, and State, lookups auto-populate when the city lookup is chosen. It...
2
by: Prashantsd | last post by:
Hi, I just wanted to know if it is possible to save the form data into different table. The combox box list are from the different tables and want save in another new table. What are the...
0
by: Michael | last post by:
I am trying to insert the same set of data into two tables with the same schema. One table is used for processing, the other for audit purposes. I thought that I could use the data change table...
1
by: romeodionisio | last post by:
How to copy data in table in a different SQL Server?.... Can anyone help me?.. Thanks....
2
by: robin1983 | last post by:
HI, I have a problem with sql query.. Actually, i have three different table eg. table1, table2, and table3. All the three table have same field name. Actually, my problem is that, whenever I insert...
2
by: sudhashekhar30 | last post by:
hi all i am using form view. i want to display record in form view from different table. like 1rst time its showing record from tableemp. 2nd time i want to show record of tableSalary in same form...
2
by: freddy windey | last post by:
Hi, this my 1st time i join discussion. im just a new programmer. i need help from your expert on this "Insert data using 1 form to 2 different table"- ASP VBscript. example- name: age: DOB:...
2
by: Kevin | last post by:
THis may be an obvious question and I'm just having a brain cramp. If so... Otherwise, I want to reference data from an unopened table. I have a table set up named CompanyConstants which contains...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.