Hi Wahida,
I came up with the following SELECT statements for doing this. Perhaps there is a way of combining these, but I had trouble due to restrictions on how RowID can be used. Anyway, this should get you the result you need. In the below, I have used a table called "Scores" and I am finding the median of the values in the "Score" column of this table. These SELECT statements can be executed in either the SQL or MapBasic window. The result will be returned in the "Scores_median" query table.
' Order the values:
SELECT Score
FROM Scores
ORDER BY Score
INTO Scores_ordered
' Count the number of records in the table:
SELECT Count(*) As "record_count"
FROM Scores
INTO Scores_count
' Retrieve the median:
SELECT Scores_ordered.Score As "median_score"
FROM Scores_ordered
WHERE RowID = ANY (SELECT Round(Scores_count.record_count/2, 1) FROM Scores_count)
INTO Scores_median
------------------------------
James Nolet
GIS Manager
Caf Consulting
Mentone office, VIC, Australia
------------------------------
Original Message:
Sent: 11-30-2023 04:40
From: Wahida Latif
Subject: Statistic Calculation in MapInfo
Hi Everyone. Good day.
How can we calculate median in MapInfo?
------------------------------
Wahida Latif
Map Information Solutions Sdn Bhd
KUALA LUMPUR
------------------------------