MySQL Forums
Forum List  »  Newbie

Re: A mal-understanding of inner joins
Posted by: John Allsopp
Date: August 02, 2017 08:27AM

OK, I've stripped everything down, here's an event table & categories, it looks to me like I should get two results returned, but I'm only getting one:

-- phpMyAdmin SQL Dump
-- version 4.6.6
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Aug 02, 2017 at 03:21 PM
-- Server version: 5.5.55-cll
-- PHP Version: 5.6.30

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `locallin_test`
--

-- --------------------------------------------------------

--
-- Table structure for table `event`
--

CREATE TABLE `event` (
`id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`event_categories` varchar(255) NOT NULL,
`event_category_1` int(11) NOT NULL,
`event_category_2` int(11) NOT NULL,
`date_from` date NOT NULL,
`date_to` date NOT NULL,
`is_recurring` tinyint(4) NOT NULL,
`approved` int(11) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `event`
--

INSERT INTO `event` (`id`, `title`, `event_categories`, `event_category_1`, `event_category_2`, `date_from`, `date_to`, `is_recurring`, `approved`) VALUES
(8752, 'Farmer\'s Market', '0', 69, 0, '2017-04-07', '2017-04-07', 0, 1),
(8871, 'African/Indian Market', '0', 27, 0, '2017-06-10', '2017-06-10', 0, 1),
(9316, 'Summer Arts & Crafts Market', '0', 50, 69, '2017-07-22', '2017-07-22', 0, 1),
(9478, 'York River Art Market', '0', 69, 32, '2017-07-29', '2017-07-29', 0, 1);

-- --------------------------------------------------------

--
-- Table structure for table `event_category`
--

CREATE TABLE `event_category` (
`id` int(11) NOT NULL,
`category_name` varchar(255) NOT NULL,
`image` text NOT NULL,
`description` text NOT NULL,
`keywords` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `event_category`
--

INSERT INTO `event_category` (`id`, `category_name`, `image`, `description`, `keywords`) VALUES
(27, 'Culture', '', '', ''),
(50, 'Crafts', '', '', ''),
(69, 'Markets', '', '', '');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `event`
--
ALTER TABLE `event`
ADD PRIMARY KEY (`id`);

--
-- Indexes for table `event_category`
--
ALTER TABLE `event_category`
ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `event`
--
ALTER TABLE `event`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9749;
--
-- AUTO_INCREMENT for table `event_category`
--
ALTER TABLE `event_category`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=110;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Options: ReplyQuote


Subject
Written By
Posted
Re: A mal-understanding of inner joins
August 02, 2017 08:27AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.