|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need help with Query
Hello,
I need help writing an Access Query. I have 3 Tables, Federal_Tax_Data, State_Tax_Data, Local_Tax_Data All 3 have a field called EmplID. What I need to get done is to Join the 3 on the EmplID, so that for all the Stat_Tax_Data records, the Employees Federal & Local Taxes appear. I wrote this Query.. SELECT PERSONAL_DATA.*, STATE_TAX_DATA.*, FEDERAL_TAX_DATA.*, LOCAL_TAX_DATA.* FROM ((STATE_TAX_DATA LEFT JOIN LOCAL_TAX_DATA ON STATE_TAX_DATA.EmplID=LOCAL_TAX_DATA.EmplID) LEFT JOIN FEDERAL_TAX_DATA ON STATE_TAX_DATA.EmplID=FEDERAL_TAX_DATA.EmplID) LEFT JOIN PERSONAL_DATA ON STATE_TAX_DATA.EmplID=PERSONAL_DATA.EmplID; This works. How ever this is where I need the help... In the State Tax Data there are multiple records for the same EmplID. Which is fine, but then for the Federal Tax Data & the Local Tax data it repeats the data for them. All I want is just 1 set of data for each of the Federal & Local Tax Data, still have the multiple for the State. I hope I explained what I need to get done. Here is some example data of what is happening & then what I want.. What is happening ------------------ EmplID StateTaxID Fed Tax Amout .....rest of fields 88501 1 80.00 88501 2 80.00 What I want ------------ EmplID StateTaxID Fed Tax Amout .....rest of fields 88501 1 80.00 88501 2 Any help would be greatly appreciated. Thank you, Jeff Janteby@AOL.com |
|
#2
|
||||
|
||||
|
You'd have to do that through a script of some kind.
If you tell SQL to fetch records, it will show all records and all fields. There's no way to get it to exclude certain fields in certain places the way you want it to because it just doesn't make sense logically. |
|
#3
|
|||
|
|||
|
what language are you using to display these results?
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Need help with Query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|