Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4

Thread: MySQL Macro?

  1. #1
    Junior Member Spasm's Avatar
    Join Date
    Feb 2008
    Posts
    19
    Member #
    16437
    I think I remember reading something about new features in MySQL 5 that let you create macros or something, but I don't remember what they were called and I can't find anything ~_~

    I want to be able to query a function, just like it were a column in my table. For example I could query this:
    Code:
    SELECT wins, losses, ratio FROM games WHERE id = 1
    Except the ratio column wouldn't actually exist, it would just be the wins / losses. I know I could do "wins / losses AS ratio", but it would make things alot easier for me if MySQL could do that little bit for me.

  2.  

  3. #2
    Junior Member womble's Avatar
    Join Date
    Mar 2008
    Posts
    15
    Member #
    16580
    is it stored procedures you're looking for?

  4. #3
    Junior Member Spasm's Avatar
    Join Date
    Feb 2008
    Posts
    19
    Member #
    16437
    Not quite. It would behave more like a function, since it returns a value. I guess if there were a way to tell a view what row I want it to pick data from, that would be it, but I don't think there's a way to do this.

  5. #4
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    You could create a view that has that virtual "ratio" column.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

macro in mysql

,
macro like functions mysql
,

mysql macro

,

mysql macros

Click on a term to search for related topics.
All times are GMT -6. The time now is 10:09 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com