SELECT
A.kat_id AS i_katid,
A.alt_id AS i_altid,
B.kat_id AS ik_katid
FROM ilan AS A JOIN ilan_kategori AS B ON B.kat_id=A.kat_id AND B.kat_id=A.alt_id