|
-
Jun 10th, 2004, 04:52 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Divide in a SQL statement?
OK.. i need to do a division in an SQL statement...
not sure how but,,,
like
fields: link_rating/number of links needs to return a new field called "sumrating" and be ordered by this in decending order...
its been a long time since i did ne fing like this and i forgot how..
so
-
Jun 10th, 2004, 05:31 PM
#2
Frenzied Member
Umm... why can't you just do the division right before you create the SQL statement?
-
Jun 10th, 2004, 05:36 PM
#3
Thread Starter
Frenzied Member
how do u mean?...
i need to get data from my database:
Code:
Select link_rating, number_of_links, (sumrating = link_rating/number_of_links)
from TABLE
Where number_of_links>0
ORDER BY sumrating DESC
-
Jun 10th, 2004, 05:49 PM
#4
Ex-Super Mod'rater
Does this not work?
Code:
Select link_rating, number_of_links, (link_rating/number_of_links) AS sumrating
from TABLE
Where number_of_links>0
ORDER BY sumrating DESC
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Jun 11th, 2004, 03:46 AM
#5
Thread Starter
Frenzied Member
OK,, LOL, how simple was that 
thanks dood.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|