5 Replies - 2520 Views - Last Post: 14 August 2012 - 12:40 AM Rate Topic: -----

#1 dag72  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 70
  • Joined: 02-March 11

MySQL returns empty results set

Posted 13 August 2012 - 03:45 PM

I have two tables, joke and author created using the the following syntax

CREATE TABLE joke(
 id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 
 joketext TEXT,
 jokedate DATE NOT NULL
)DEFAULT CHARACTER SET utf8

CREATE TABLE author(
 id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
 name VARCHAR(255),
 email VARCHAR(255)
)DEFAULT CHARACTER SET utf8 


These tables created sucessful and i have entered data into them successful both manual and from using php, however, when i attempted to join both tables the i recieved the following message 'MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0012 sec )' i also notice that my authorid column within the joke table has NULL value as oppose to the respective id.

Could you please tell me where i am going wrong? Here is the syntax for the join using the 'ON' clause
 SELECT *
FROM joke INNER JOIN author ON authorid = author.id


Is This A Good Question/Topic? 0
  • +

Replies To: MySQL returns empty results set

#2 GunnerInc  Icon User is online

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,277
  • Joined: 28-March 11

Re: MySQL returns empty results set

Posted 13 August 2012 - 03:51 PM

Please don't post help questions in the tutorial section. I moved it for you.
Was This Post Helpful? 0
  • +
  • -

#3 dag72  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 70
  • Joined: 02-March 11

Re: MySQL returns empty results set

Posted 13 August 2012 - 03:55 PM

Thanks
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3485
  • View blog
  • Posts: 10,045
  • Joined: 08-June 10

Re: MySQL returns empty results set

Posted 13 August 2012 - 09:20 PM

View Postdag72, on 14 August 2012 - 12:45 AM, said:

Could you please tell me where i am going wrong? Here is the syntax for the join using the 'ON' clause
 SELECT *
FROM joke INNER JOIN author ON authorid = author.id

there is no field authorid in your table.
Was This Post Helpful? 0
  • +
  • -

#5 dag72  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 70
  • Joined: 02-March 11

Re: MySQL returns empty results set

Posted 13 August 2012 - 11:55 PM

Thanks but there is defo an authorid field in my table, i omitted this line of code by mistake when i made this post...
authorid INT

This post has been edited by dag72: 14 August 2012 - 12:09 AM

Was This Post Helpful? 0
  • +
  • -

#6 dag72  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 70
  • Joined: 02-March 11

Re: MySQL returns empty results set

Posted 14 August 2012 - 12:40 AM

I resolved this, thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1