I am by no means fluent in MYSQL. What I am trying to do is I have a table that has a list of Galleries with unique ID numbers. I have another table ImageData that has images that may be as many as 1000 that are related to each GalleryID that is in the first table. I want to do a select that will get 5 random records from each Gallery...
I have two tables: locations and listings.
locations
id title address latitude longitude
listings
id location info status
SELECT locations.title,
locations.address,
( 3959 * acos( cos( radians('".$center_lat."') ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians('".$center_lng."') ) + sin( radians...
Quick question, I have a table of messages each with a timestamp and a reply_id and a topic_id. Reply_ids can be the same as others, which means those messages are in the same group of replies. When I select a reply_id with the min timestamp, meaning it was the first message of that group, I would also like to know its numbered place wit...
I have a table setup like this (simplified for example):
user_id
item_id
click_dt
Each item_id has many user_id's. Basically it's storing the clicks on items, associated to a user_id.
I want to query through this and list only the latest user_id for each item_id, based on click_dt.
So if there are 5 clicks for item_id 55, the last ...
I trying find a simple python-based algorithmic ranking system.
Here's the scenario:
There will be 30 levels, level 1 starts at 0 points. 2000 points are required to achieve level 30.
More points will be required as the levels progress.
For example, to go from level 1 to 2 might take 3 points. Level 2 to 3 might take 5 additional poi...
I have a database table that contains blog posts. I want to show on the homepage one (or more) post for each category, ordering by date, for example.
So my posts table looks like this: id | title | description | cat | filename | date
How would I create such a query? I've thought to use group-by or a subselect but I'm not sure if it's ...
Someone gave me a -1. Not displaying my source code anymore, this has been resolved.
...
Hi
Im looking for a site that provides leaderboards, via an api. that i can use to keep ranking tables for offline sports, and also if i want to access it via an api to pull in to my blog etc.
thanks!
...
I would like to rank or sort a collection of items (with size potentially greater than 100,000) where each item in the collection does not have an intrinsic (comparable) value, instead all I have is the comparisons between any two items which have been provided by users in a 'subjective' manner.
Example:
Consider a collection with el...
If I have a table of random values in a sql table, how can I export and display them as a raking rather than the absolute value... for example.. if the three values are 30 85 and 90 how do i get 30 do display as 1 or 1st, 85 as 2 or 2nd etc
...
this is the hacker news ranking algorithm, which i think is a simple way of ranking things, espcially if users are voting on items, but i really dnt understand this, can this be converted to php, so i can understand it fully?
; Votes divided by the age in hours to the gravityth power.
; Would be interesting to scale gravity in a sli...
I am facing a very common issue regarding "Selecting top N rows for each group in a table".
Consider a table with id, name, hair_colour, score columns.
I want a resultset such that, for each hair colour, get me top 3 scorer names.
To solve this i got exactly what i need on Rick Osborne's blogpost "sql-getting-top-n-rows-for-a-grouped-...