Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Question about creating a SQL Statement

Posted on 1998-08-26
4
Medium Priority
?
176 Views
Last Modified: 2010-04-30
I have the following tables and fields in an Access database
Appointments
    AppointmentID  (key field)
    OwnerID        (link field to other table)
    PetID          (link field to other table)
    AppointmentDate
Owners
    OwnerID     (key field)
    Name
Pets
    PetID       (key field)
    Name

What I need is a SQL Statement that will put them all together, ie so that I can refer to
.fields("Owners.Name")  and
.fields("Pet.Name")
0
Comment
Question by:PCav
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
lawnranger earned 200 total points
ID: 1431119
SELECT * FROM Appointments, Owners, Pets WHERE
Appointments.OwnerID=Owners.OwnerID AND
Appointments.PetID=Pets.PetID


0
 
LVL 1

Expert Comment

by:raygibbins
ID: 1431120
I would have used the following , it allow you to add records to the recordset if it is a dynaset

SELECT Owners.Owner, Pets.PetName, Appointments.AppontmentDate
FROM Pets INNER JOIN (Owners INNER JOIN Appointments ON Owners.OwnerID = Appointments.OwnerID) ON Pets.PetID = Appointments.PetID;

0
 
LVL 1

Expert Comment

by:lawnranger
ID: 1431121
raygibbins is right...if you need updateable and you are selecting from multiple tables you need JOIN.
0
 

Author Comment

by:PCav
ID: 1431122
Thanks Ray, but I already gave the points to lawnranger.  I don't need to update the records, just cycle through them and add the information to a listview control
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question