Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
midpenntech
Posting Yak Master
137 Posts |
Posted - 2008-05-06 : 12:26:35
|
I am trying to create a report that is using 2 tables. The first table is called equipdaily. The 2 fields I am using are Equipdaily.kequipnumber, the second one is equipdaily.equipstatus. I then need to join into another table called Equipdet. The field I link with the Pk is (kequipnumber). The Field I grabbed from that table was equipdet.kordernumber. The problem I am having is we have rented out these equip to other people and its pulling all data. I want the most recent one. So I am assuming I need to use the max code. Here is what I have so far and it works I just dont know how to add the Max to either equipnum or if it should be added to ordernum. please help me out. SELECT DISTINCT equipdet.kequipnum, equipdet.kordnum, equipdaily.eqpstatusFROM equipdaily INNER JOIN equipdet ON equipdaily.kequipnum = equipdet.kequipnumWHERE (equipdaily.eqpstatus = 'ON') |
|
|
|
|