Use php to order by number and echo the last five rows (sql)
Posted: Mon Feb 08, 2010 7:21 am
I want to select data from four different tables -> mix the data -> order by timestamp -> echo the data from the five last rows.
Example:
OUTPUT:
Example:
Code: Select all
TABLE 1
{
row 1
{
title: 'data1blabla';
type: 'Interview';
ts: 1265634051;
}
row 2
{
title: 'data2blabla';
type: 'Interview';
ts: 1265634055;
}
}
TABLE 2
{
row 1
{
title: 'data3blabla';
type: 'Trailer';
ts: 1265634056;
}
}
TABLE 3
{
row 1
{
title: 'data4blabla';
type: 'Gallery';
ts: 1265634053;
}
row 2
{
title: 'data5blabla';
type: 'Gallery';
ts: 1265634061;
}
}
TABLE 4
{
row 1
{
title: 'data6blabla';
type: 'Article';
ts: 1265634052;
}
}Code: Select all
'data4blabla - Trailer - 1265634092'
'data8blabla - Article - 1265634078'
'data6blabla - Gallery - 1265634061'
'data3blabla - Trailer - 1265634056'
'data2blabla - Interview - 1265634055'