sql - ambiguous error in mysql recordset in Dreamweaver -


the following recordset in dreamweaver throws 1052 ambiguous error every time attempt test it. know has dateadded, don't know how fix it.

    select commentid, commenttitle, commentcontent, topictable.topictitle,  dayname(dateadded) day, monthname(dateadded) month,  day(dateadded) date, year(dateadded) year commenttable, topictable commentid = colname , topictable.topidid = commenttable.topicid 

here layout of tables,

create table usertable ( userid varchar(15) not null, screenname varchar(15) not null unique, userpasswd char(40) not null, firstname varchar(15) not null, lastname varchar(25) not null, datejoined timestamp not null default current_timestamp, lastlogin datetime, primary key(userid) ) ;  create table categorytable                                           ( categoryid mediumint auto_increment not null,                        categoryname varchar(30) not null,                                   categorydescription varchar(200) not null,                           primary key (categoryid) ) ;  create table topictable                                              ( topicid mediumint auto_increment not null,                           topictitle varchar(30) not null,                                     userid varchar(15) not null,                                         dateadded timestamp not null default current_timestamp,              categoryid mediumint not null,                                       primary key (topicid) ) ;  create table commenttable                                            ( commentid mediumint auto_increment not null,                         commenttitle varchar(30) not null,                                   commentcontent text not null,                                        userid varchar(15) not null,                                         dateadded timestamp not null default current_timestamp,              topicid int not null,                                                primary key (commentid) ) ; 

dateadded represented in both tables, should choose 1 want in result set :

select ct.commentid      , ct.commenttitle      , ct.commentcontent      , tt.topictitle      , dayname(ct.dateadded) `day`      , monthname(ct.dateadded) `month`      , day(ct.dateadded) `date`      , year(ct.dateadded) `year` commenttable ct join topictable tt on ct.commentid = tt.colname  , tt.topidid = ct.topicid 

by way, still wonder, colname stands for, maybe should ct.userid = tt.userid instead?


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -