Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6337989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:21:26+00:00 2026-05-24T19:21:26+00:00

This relates to a webpage that should show all upcoming events, and mark any

  • 0

This relates to a webpage that should show all upcoming events, and mark any that are in the current user’s diary.

diary table
diary_id
member_id
event_id

event table
event_id
region_id
…

region table
region_id
…

member table
member_id
…

QUERY:

SELECT event.*, region.name, diary.diary_id 
FROM event, region 
LEFT JOIN diary on diary.member_id = 10 AND diary.event_id = event.event_id
WHERE region.region_id = event.region_id AND `date` >= NOW()

This is returning unknown column event.event_id and I can’t figure out why. I’m no SQL whiz but expected this would just work and give me a NULL in the diary_id column for all events that are not in the user’s diary

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:21:27+00:00Added an answer on May 24, 2026 at 7:21 pm

    You are mixing join syntax. Try this instead.

    SELECT event.*,
           region.name,
           diary.diary_id
    FROM   event
           INNER JOIN region
             ON region.region_id = event.region_id
           LEFT JOIN diary
             ON diary.member_id = 10
                AND diary.event_id = event.event_id
    WHERE  `date` >= NOW()  
    

    Update

    Your problem with not finding event_id is because of this FROM event, region. It can’t find event_id in the on clause. Change your query as suggested above but it would also be possible to fix it by switching places of the tables to FROM region, event. Don’t do that. Use the new join syntax introduced to the SQL language some 20 years ago.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This relates to my other question on accessing a REST service that uses forms
Please keep in mind that I am VERY new to all of this javascript/node.js
i have a webpage that looks like this: http://yoursdproperty.com/index2.php?option=com_jumi&fileid=3&Itemid=11 i want the page to
This relates to Composite Application Guidance for WPF, or Prism. I have one MainRegion
This relates to my previous post: jQuery .load Method causing page refresh AJAX I
This question relates to my answer of another of my question. The original question
This question relates to this question which I asked earlier this week. The answer
This question relates to those parts of the KenKen Latin Square puzzles which ask
This post relates to this: Add row to inlines dynamically in django admin Is
James here. This question relates (sort of) to the one I posted a little

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.