Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Tables w/same fields

Status
Not open for further replies.

lisa626

Programmer
Aug 9, 2006
92
0
0
US
I have to link together two tables, one is a tickets table with a ticket number, date, total cost etc..., the other is an airseg table with a ticket number, depart date, depart time etc...

I need to link the two together via the ticket number, however, there may be multiple of the same ticket numbers in airseg but only one in the tickets table, how do I link together so it doesn't show me duplicates when I run the data???
 
You can group by ticket number but you would need to use an aggregate function on the field(s) you want to display from the airseg table. Something like:

Select t.ticketnumber, max(a.date)
from tickets t inner join airseg a
on t.ticketnumber = a.ticketnumber
group by t.ticketnumber
 
I'm sorry, need a bit further clarification, when I join the two tables, on what field do I link and what type of link do I use, THEN, where does the function above go, in a formula??
 
Link the tables on the ticket number. Then you could group on the ticket number and place the fields in the group header and suppress the detail section. The ticket will only appear once, with the information from the first airsegment record that is returned to the report. If you want certain specific information from the airsegment table, you should explain further.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top