Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with mysql inner join

Status
Not open for further replies.

david55

Programmer
Oct 23, 2007
6
NL
Hi all .I am have 2 tables as shown below. I run this query and i get no sets of data!! idyoutube in both tables are the same. i have 2 playlists and one video in each but the query returns nothing!! I be happy if some help me fix this query.

Code:
select F.idyoutube, F.thumbnail_url, F.title, F.view_count, F.comment_count, F.embed_status from playlist as P inner join youtubevideos2 as F on F.idyoutube = P.idyoutube where playlistname='popsong'

Code:
CREATE TABLE `playlist` (
  `User_ID` int(10) unsigned NOT NULL default '0',
  `idyoutube` varchar(93) character set latin1 NOT NULL default '0',
  `playlistname` varchar(32) character set latin1 NOT NULL default '',
  UNIQUE KEY `Index_1` (`User_ID`,`idyoutube`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;


CREATE TABLE `youtubevideos2` (
  `ID` int(11) NOT NULL auto_increment,
  `author` varchar(93) NOT NULL default '0',
  `idyoutube` varchar(93) NOT NULL default '0',
  `title` varchar(93) NOT NULL default '0',
  `length_seconds` int(10) unsigned NOT NULL default '0',
  `rating_avg` int(10) unsigned NOT NULL default '0',
  `rating_count` int(10) unsigned NOT NULL default '0',
  `description` varchar(255) NOT NULL default '0',
  `view_count` int(10) unsigned NOT NULL default '0',
  `upload_time` int(10) unsigned NOT NULL default '0',
  `comment_count` int(10) unsigned NOT NULL default '0',
  `tags` varchar(93) NOT NULL default '0',
  `url` varchar(93) NOT NULL default '0',
  `thumbnail_url` varchar(93) NOT NULL default '0',
  `embed_id` varchar(93) NOT NULL default '0',
  `embed_status` varchar(93) NOT NULL default '0',
  PRIMARY KEY  (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=237 ;

 
sorry, i don't do php

have you tried running the query directly in mysql, i.e. outside of php?

r937.com | rudy.ca
 
yes i tried it and it worked. I couldn't edit my post that is why i couldn't change it!!
 
i fixed that problem . Could you tell me how to count the number of rows of my join query? Just like this but for my inner join query?

SELECT COUNT(idyoutube) AS numrows FROM `formyspace`
 
there's a php function for the number of rows returned, called num_mysql_rows or something like that

or perhaps you're thinking of paging? and want to know the count while doing a LIMIT?

look up the mysql FOUND_ROWS function

:)

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top