Jump to content
yrstruly

Stored Procedure

Recommended Posts

I have a table: Named  HighScores  

"INSERT HighScores 
VALUES ('Bob', 2500, '2 Jan 2013 13:13'),
           ('Jon', 1500, '2 Jan 2013 13:15'),
       ('Amy', 3500, '2 Jan 2013 13:18')"

I want to create a stored procedure that would:

The score must show the TOP 5 or so people.

Show your position on the high score board

Show the person in front and below you on the high score board.

If the scores are tied, the person who got it the most recent is shown higher.

Can anybody assist me please?

Share this post


Link to post
Share on other sites

It doesn't work for MySQL Workbench:

CREATE PROCEDURE SelectAllCustomersAS
SELECT * FROM Customers
GO;
EXEC SelectAllCustomers;

But it is working:

DELIMITER //

CREATE PROCEDURE SelectCategory()
BEGIN
    SELEC
T * FROM category;
END //

CALL SelectCategory();    

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...