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 599191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:28:16+00:00 2026-05-13T16:28:16+00:00

I have two tables that I want to query and merge based on a

  • 0

I have two tables that I want to query and merge based on a category_id.

My events table has a column called event_category_id that creates a relationship between the event and it’s category. The value is an int.

In my categories table I have a column called category_id which is what I want to match on and replace the int value with the varchar value of category_name.

What’s my syntax? Thanks for the help!

categories
CREATE TABLEwp_wild_dbem_categories(
category_idint(11) NOT NULL auto_increment,
category_nametinytext NOT NULL,
PRIMARY KEY (
category_id)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1

events
CREATE TABLEwp_wild_dbem_events(
event_idmediumint(9) NOT NULL auto_increment,
event_authormediumint(9) default NULL,
event_nametinytext NOT NULL,
event_start_timetime NOT NULL default '00:00:00',
event_end_timetime NOT NULL default '00:00:00',
event_start_datedate NOT NULL default '0000-00-00',
event_end_datedate default NULL,
event_notestext,
event_rsvptinyint(1) NOT NULL default '0',
event_seatstinyint(4) default NULL,
event_contactperson_idmediumint(9) default NULL,
location_idmediumint(9) NOT NULL default '0',
recurrence_idmediumint(9) default NULL,
event_category_idint(11) default NULL,
UNIQUE KEY
event_id(event_id)
) ENGINE=MyISAM AUTO_INCREMENT=26 DEFAULT CHARSET=latin1

  • 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-13T16:28:16+00:00Added an answer on May 13, 2026 at 4:28 pm

    I don’t think you want a UNION. You probably want something like this:

    SELECT e.event_id, e.other_field, c.category_name
    FROM events e JOIN categories c ON (e.category_id=c.category_id)
    WHERE some_condition;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have data in two tables that I want to query from. Each table
I have two tables that I want to use in my query, tblEmployee and
I have a two mysql tables that I want to merge together in one
I have two tables in a derby database that I want to query together.
I have two tables, both having column a device_id column that I want to
I have two tables that I want to join together. Table1 Year, ID, Theme,
If i have two tables that have nothing in common I want to do
I have two tables and I want to display only the child ID that
I want to delete multiple records at once. I have two tables, one that
I have two tables that I am joining with the following query... select *

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.