Can Someone Help Me This Mysql Query Please??

3 replies
Alright guys

I dont know if you can help but I thought I ask

I am trying to set up a mysql query so that I can only display the latest category that has been added to my site...

On the table that I am trying to create it under it has got the following infomration..

id (numeric number)
cat_name (name of category

The id increses by one each time I add new category to the site... For example if I add one now called it Master it will have the id 1 allocated to it.. Then tomorrow I add another category call it Private will have the id 2 to it, and so..

At the moment I can get all categories to be displayed.. I just want it to the latest one..

Can anyone help please??
#mysql #query
  • Profile picture of the author imarketstuff
    good morning

    Code:
    select id,cat_name from table_name order by id DESC limit 1
    peace
    Signature
    I MARKET STUFF

    {{ DiscussionBoard.errors[1889430].message }}
  • Profile picture of the author imarketstuff
    or..

    Code:
    select max(id),cat_name from table_name
    Signature
    I MARKET STUFF

    {{ DiscussionBoard.errors[1890028].message }}
  • Profile picture of the author m4rx
    Of course, make it super simple to read :]

    --m4rx
    Signature
    We are what we repeatedly do. Excellence, then, is not an act, but a HABIT. ~Aristotle
    Bored. Learn everything you need to know about Organic Gardening.
    {{ DiscussionBoard.errors[1895101].message }}

Trending Topics