Jump to content

Relationships with SQL


Recommended Posts

I'm making a results page for a organization with members names and email address on my website. The thing is, not every member has an email address. The secertary only enters the email address in of the member and uploads in though Access 97. I have set up an extra table that would include the fallowing fields: ID, Firstname, Lastname, email. The code that I came up with is:

 

SELECT emails.*, members.*

FROM emails INNER JOIN members ON emails.ID = members.ID

ORDER BY members.lastname ASC

 

This works, but it only pulls up members with email addresses in both tables. How do I make it so that if the address does not exsit, it just leaves the field blank on the report, but still shows the members name

Link to comment
Share on other sites

Not sure if this will work but it is worth a try...just switch everything...

 

You had:

SELECT emails.*, members.*

FROM emails INNER JOIN members ON emails.ID = members.ID

ORDER BY members.lastname ASC

 

Try:

SELECT members.*, emails.*

FROM members INNER JOIN emails ON members.ID = email.ID

ORDER BY members.lastname ASC

 

that might possibly do the trick...

 

Let me know the outcome

 

BS ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.