Link to home
Start Free TrialLog in
Avatar of dazzled1
dazzled1

asked on

Can you use an Inline Query in mysql?

Can you use an Inline Query in mysql?

I am not sure if it is even possible and I can't find any documentation on it or make it work...

Hope you can help!!

SELECT c.NAME catname,
            t.ID id,
            t.title,
            u.USERNAME username,
            DATE_FORMAT(t.date,'%d/%m/%Y %h:%i%p') date,
            p.p_date
FROM category c,
         topics t,
         users u,
         (SELECT max(date) p_date
                    , topic_id p_topic_id
          FROM post
          GROUP BY topic_id) p
WHERE t.cat_id = c.ID
AND t.USERID = u.ID
AND p.p_topic_id = t.id
ORDER BY t.date DESC


Is there an equivalent if you cannot do it this way?


Dave
Avatar of william_jwd
william_jwd
Flag of United States of America image

I think, this should work...
What is the error you are getting...
Avatar of dazzled1
dazzled1

ASKER

I get the following error.


MySQL said:


#1064 - 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 'SELECT max( date ) p_date, topic_id p_topic_id
FROM post
GROUP



This would work in Oracle... Unfortuantely I am not an expert in MYSQL
Right up to 500 points now!
ASKER CERTIFIED SOLUTION
Avatar of psadac
psadac
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial