I have data in table, and want get top of ID (parent id from child ID).

```
id (primary_key)        item_id             secondary_item_id
464                     449                 449
465                     449                 464
467                     449                 465

```

From this table i want get id `'464'` from id `'467'`. I try:

```
$parent_id = $wpdb->get_var( "
    SELECT id
    FROM {$bp->activity->table_name}
    WHERE id = 467
" );

```

But return `465`, i want `464`. And i want use just one query., not multiple query.
Please help.