I have three tables, each contain some common information, and some information that is unique to the table.
For example: uid, date are universal among the tables, but one table can contain a column type while the other contains currency.
I need to query the database and get the last 20 entries (date DESC) that have been entered in all three tables.
My options are:
Üç
UNION ALLhükümler içeren, büyük bir sorgu ile bir kez veritabanını sorgulamak ve, sütunlar için sahte değerlerle birlikte IE pass:FROM ( SELECT uid, date, currency, 0, 0, 0ve daha sonra
FROM ( SELECT uid, date, 0, type, 0, 0Bu null değerli alanlar tahsis beni bırakacaktı ..
YA ben kombine son 20 Mesajları almak için bilgi yoluyla
sortPHP içinde nasılsa veritabanını üç kez sorgulamak ve edebilirsiniz. (LIMIT 20) * 3'e bakmak için 60 Mesajları - - Bu bir bilgi fazlalığı ile beni terk edeceğini ve addtional quicksort çeşit her zaman preform beni zorlar.
Ne seçeneğin daha iyi / herhangi bir alternatif fikirler?
Teşekkürler.