I am retrieving rows from MySQL to a a table in FPDF. this table has
to be ordered by activities that have members (5.3, 5.4.4, 6.6,
11.1.2.3....) these numbers are random. I have tried many ways such as using CAST or order by * 1 but there is always a mistake in the order.
This query is the closest i have come to a correct order, but it is
still incorrect.
have attatched a sample of the result that should show 6.1 at the beginning. However, it starts with 10
this is my table called pack.
+----------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+----------------+
| id | int(10) | NO | PRI | NULL | auto_increment |
| budget_hours | int(10) | YES | | NULL | |
| a_description | varchar(255) | YES | | NULL | |
| bogie_type_id_ | int(10) | YES | | NULL | |
| skillset | varchar(100) | YES | | NULL | |
| budget_mins | int(10) | YES | | NULL | |
| activity | varchar(10) | YES | | NULL | |
+----------------+--------------+------+-----+---------+----------------+
and this is transactions table
+------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+--------------+------+-----+---------+----------------+
| id | int(10) | NO | PRI | NULL | auto_increment |
| activity | varchar(20) | YES | | NULL | |
| status | varchar(10) | YES | | NULL | |
| name | varchar(20) | YES | | NULL | |
| bogie_id | int(10) | YES | | NULL | |
| bogie_serial_no_ | varchar(100) | YES | | NULL | |
| duration | int(10) | YES | | NULL | |
| start_timestamp | int(10) | YES | | NULL | |
| end_timestamp | int(10) | YES | | NULL | |
+------------------+--------------+------+-----+---------+----------------+
select transaction.activity, pack.a_description, transaction.name,
pack.activity as pa, FROM_UNIXTIME(transaction.end_timestamp, '%d/%m/%Y') as et
from transaction
inner join pack on pack.activity=transaction.activity
where transaction.bogie_id='$id' and bogie_type_id_='$bt'
order by REPLACE(pa,'.','') ASC