Mike Shanley wrote:
Stut wrote:
I'm not sure what you mean by "extra indexing memory". The autonumber
feature is simple in that MySQL just keeps track of the last ID used
and increments it to get the next one. However, I don't think there is
any overhead caused by deleted records. If you can cite a source for
that statement then I'd be interested to hear about it.
I mean the extra space used up to set /any/ row as a key, not overhead
for deleting. But you're right that the auto-increment is separate from
indexing. Even still, I need a simple way to fill those holes.
There is no "simple" way. But this question comes up fairly often, and
the usual answer is that there's no need to fill the holes. Why do you
think you need to fill the holes? If there is no good reason to do it,
why are you bothering?
select * from tablename where id in (1,2,3,4,5,6,7)
So essentially, you're telling me not to store the ID numbers I want to
call in an array then, eh?
I don't believe I said that at all. Let's say you have an array of IDs...
$ids = array(1, 2, 3, 4, 5, 6, 7);
Then you build the SQL statement above like so...
$sql = 'select * from tablename where id in ('.implode(',', $ids).')';
If you can't join the tables together then they're not related, so
you'll need to do separate DB calls. I'm not sure where the problem is
here.
I'm just wondering if there's a way to combine calls to 5 different
tables down to 1 query, as though all the info needs to be organized
separately, it's going to the same place.
No, you can't. If you can't join the tables together in any meaningful
way, you can't write a single SQL statement that will get results from
more than one of them at a time.
Again, I think you're looking for a problem where no problem exists.
-Stut
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php