sql server - SQL query inner join -


i want modify query in forum code, return 2 fields table tblprofile. table has 2 fields, 'emailaddress' , 'emailverified'.

this original query:

select *    (select top 10 [scirra].[dbo].[tblforumthread].thread_id,                        [scirra].[dbo].[tblforumthread].message,                        [scirra].[dbo].[tblforumthread].message_date,                        [scirra].[dbo].[tblforumthread].show_signature,                        [scirra].[dbo].[tblforumthread].ip_addr,                        [scirra].[dbo].[tblforumthread].hide,                        [scirra].[dbo].[tblforumauthor].author_id,                        [scirra].[dbo].[tblforumauthor].username,                        [scirra].[dbo].[tblforumauthor].homepage,                        [scirra].[dbo].[tblforumauthor].location,                        [scirra].[dbo].[tblforumauthor].no_of_posts,                        [scirra].[dbo].[tblforumauthor].join_date,                        [scirra].[dbo].[tblforumauthor].signature,                        [scirra].[dbo].[tblforumauthor].active,                        [scirra].[dbo].[tblforumauthor].avatar,                        [scirra].[dbo].[tblforumauthor].avatar_title,                        [scirra].[dbo].[tblforumgroup].name                               groupname,                        [scirra].[dbo].[tblforumgroup].stars,                        [scirra].[dbo].[tblforumgroup].custom_stars,                        [scirra].[dbo].[tblforumguestname].name                               guestname,                        row_number() on (order                               [scirra].[dbo].[tblforumthread].message_date asc)                                               rownum           ([scirra].[dbo].[tblforumgroup]                  inner join ([scirra].[dbo].[tblforumauthor]                  inner join [scirra].[dbo].[tblforumthread]                   on [scirra].[dbo].[tblforumauthor].author_id = [scirra].[dbo].[tblforumthread].author_id)                  on [scirra].[dbo].[tblforumgroup].group_id = [scirra].[dbo].[tblforumauthor].group_id)                  left join [scirra].[dbo].[tblforumguestname]                  on [scirra].[dbo].[tblforumthread].thread_id = [scirra].[dbo].[tblforumguestname].thread_id                      [scirra].[dbo].[tblforumthread].topic_id = 33854                 , ( [scirra].[dbo].[tblforumthread].hide = 0                        or [scirra].[dbo].[tblforumthread].author_id = 13405 ))                                   pagingquery   rownum between 1 , 10;  

i've got far selecting fields:

 ,  [scirra].[dbo].[tblprofile].emailaddress,   [scirra].[dbo].[tblprofile].emailverified 

but i'm bit stuck on doing join in nest!

any appreciated!

edit

sorry! need join tblprofile.userid tblauthor.author_id

ok, if understood query correctly, can try this:

select *    (select top 10 [scirra].[dbo].[tblforumthread].thread_id,                        [scirra].[dbo].[tblforumthread].message,                        [scirra].[dbo].[tblforumthread].message_date,                        [scirra].[dbo].[tblforumthread].show_signature,                        [scirra].[dbo].[tblforumthread].ip_addr,                        [scirra].[dbo].[tblforumthread].hide,                        [scirra].[dbo].[tblforumauthor].author_id,                        [scirra].[dbo].[tblforumauthor].username,                        [scirra].[dbo].[tblforumauthor].homepage,                        [scirra].[dbo].[tblforumauthor].location,                        [scirra].[dbo].[tblforumauthor].no_of_posts,                        [scirra].[dbo].[tblforumauthor].join_date,                        [scirra].[dbo].[tblforumauthor].signature,                        [scirra].[dbo].[tblforumauthor].active,                        [scirra].[dbo].[tblforumauthor].avatar,                        [scirra].[dbo].[tblforumauthor].avatar_title,                        [scirra].[dbo].[tblforumgroup].name                               groupname,                        [scirra].[dbo].[tblforumgroup].stars,                        [scirra].[dbo].[tblforumgroup].custom_stars,                        [scirra].[dbo].[tblforumguestname].name                               guestname,                        [scirra].[dbo].[tblprofile].emailaddress,                        [scirra].[dbo].[tblprofile].emailverified,                       row_number() on (order                               [scirra].[dbo].[tblforumthread].message_date asc)                                               rownum           [scirra].[dbo].[tblforumgroup]                  inner join [scirra].[dbo].[tblforumauthor]                  on [scirra].[dbo].[tblforumgroup].group_id = [scirra].[dbo].[tblforumauthor].group_id                 inner join [scirra].[dbo].[tblforumthread]                  on [scirra].[dbo].[tblforumauthor].author_id = [scirra].[dbo].[tblforumthread].author_id                 left join [scirra].[dbo].[tblforumguestname]                  on [scirra].[dbo].[tblforumthread].thread_id = [scirra].[dbo].[tblforumguestname].thread_id                  left join [scirra].[dbo].[tblprofile]                 on [scirra].[dbo].[tblprofile].userid = [scirra].[dbo].[tblforumauthor].author_id         [scirra].[dbo].[tblforumthread].topic_id = 33854                , ([scirra].[dbo].[tblforumthread].hide = 0 or [scirra].[dbo].[tblforumthread].author_id = 13405 )) pagingquery   rownum between 1 , 10;  

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -