EDITED
I m using this select query with left join:
$updaterbk = "SELECT j1. *
FROM jos_audittrail j1
LEFT OUTER JOIN jos_audittrail j2 ON ( j1.trackid != j2.trackid
AND j1.field != j2.field
AND j1.changedone < j2.changedone )
WHERE j1.operation = 'UPDATE'
AND j2.id IS NULL
";
which outputs me an array:
Array
(
[0] => Array
(
[id] => 137
[trackid] => 153
[table_name] => jos_menu
[operation] => UPDATE
[oldvalue] => 0
[newvalue] => 62
[field] => checked_out
[live] => 0
[changedone] => 2010-05-11 17:46:28
)
[1] => Array
(
[id] => 138
[trackid] => 153
[table_name] => jos_menu
[operation] => UPDATE
[oldvalue] => 0000-00-00 00:00:00
[newvalue] => 2010-05-11 12:16:28
[field] => checked_out_time
[live] => 0
[changedone] => 2010-05-11 17:46:28
)
[2] => Array
(
[id] => 139
[trackid] => 153
[table_name] => jos_menu
[operation] => UPDATE
[oldvalue] => Subhash
[newvalue] => Subhashgfhfgh
[field] => name
[live] => 0
[changedone] => 2010-05-11 17:46:35
)
[3] => Array
(
[id] => 140
[trackid] => 153
[table_name] => jos_menu
[operation] => UPDATE
[oldvalue] => subhash
[newvalue] => subhashhfhf
[field] => alias
[live] => 0
[changedone] => 2010-05-11 17:46:35
)
[4] => Array
(
[id] => 141
[trackid] => 153
[table_name] => jos_menu
[operation] => UPDATE
[oldvalue] => 62
[newvalue] => 0
[field] => checked_out
[live] => 0
[changedone] => 2010-05-11 17:46:35
)
[5] => Array
(
[id] => 142
[trackid] => 153
[table_name] => jos_menu
[operation] => UPDATE
[oldvalue] => 2010-05-11 12:16:28
[newvalue] => 0000-00-00 00:00:00
[field] => checked_out_time
[live] => 0
[changedone] => 2010-05-11 17:46:35
)
)
here in this array I dont want any values to be displayed twice for, i.e. I ned the first occurrence of the value only. Now here u can see that the index "field" has repeated values i.e. "checked_out" and "checked_out_time" other indexes have single occurrence, now what should I do to select/grab the first occurrence of the repetitive values only?