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!

Querry Help Please

Status
Not open for further replies.

manking

MIS
Jan 29, 2003
28
US
Can anyone help me convert this access statement to a mysql statement that works

select top 50 a.Unique_ID, a.Date_Creation, a.createdBy_UserName, a.replies, a.views, a.lastPost_UserName, a.subject, a.Date_LastPost, a.locked, a.announcement, a.lastPost_UserID, a.createdBy_UserID, a.movedFrom, (select Visit_Date from Gerobase_Forum_TopicUserVisit b where b.user_ID = 27 and b.topic_ID = a.Unique_ID limit 1) as lastVisit, (select answer from Gerobase_Forum_Messages c where c.answer = true and c.topic_ID = a.Unique_ID limit 1) as answered from Gerobase_Forum_Topics a where ( a.subject like '%place%' and a.forum_ID in (24)) order by a.announcement, a.Date_LastPost desc
 
Code:
select a.Unique_ID
     , a.Date_Creation
     , a.createdBy_UserName
     , a.replies
     , a.views
     , a.lastPost_UserName
     , a.subject
     , a.Date_LastPost
     , a.locked
     , a.announcement
     , a.lastPost_UserID
     , a.createdBy_UserID
     , a.movedFrom
     , ( select max(Visit_Date) 
           from Gerobase_Forum_TopicUserVisit b 
           where b.user_ID = 27 
             and b.topic_ID = a.Unique_ID ) as lastVisit
     , ( select max(answer) 
           from Gerobase_Forum_Messages c 
          where c.answer = true 
            and c.topic_ID = a.Unique_ID ) as answered 
  from Gerobase_Forum_Topics a 
 where a.subject like '%place%' 
   and a.forum_ID in (24) 
order 
    by a.announcement
     , a.Date_LastPost desc 
limit 50

r937.com | rudy.ca
 
Thank you I have placed this in the querry browser

select a.Unique_ID
, a.Date_Creation
, a.createdBy_UserName
, a.replies
, a.views
, a.lastPost_UserName
, a.subject
, a.Date_LastPost
, a.locked
, a.announcement
, a.lastPost_UserID
, a.createdBy_UserID
, a.movedFrom
, ( select max(Visit_Date)
from Gerobase_Forum_TopicUserVisit b
where b.user_ID = 27
and b.topic_ID = a.Unique_ID ) as lastVisit
, (
where a.subject like '%place%'
and a.forum_ID in (24)
order
by a.announcement
, a.Date_LastPost desc
limit 50

and received this error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where a.subject like '%place%'
and a.forum_ID in (24)' at line 19
 
r937 answer was correct thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top