Richard schrieb:
> I want to have a list of titles to which I can add new ones either at
> the end of the list or in a chosen position so I can choose what order
> they show up in.
>
> The first solution that I thought of was to add one to all of the
> position values heigher than the position I wish to insert the new one
> to. But this would envolve alot of queries and therefore resources.
>
> So now I'm wandering if it is possible to do this directly with mysql.
> Here is an example of what I want to do
> I will have a table called titles like this :
>
> --------------------------------
> table : title
> -------------------------------
> POSTITION | TITLE
> 1 | title joejjeo
> 2 | title ejuejej
> 3 | title ekkke
> 4 | title eueoueo
> 5 | title eehiehiehop
>
>
> And I wish to insert :
>
> 3 | title inserted
>
> So that titles in positions 3, 4 and 5 become titles 4, 5 and 6
just two queries:
UPDATE `title`
SET `POSTITION` = `POSTITION` + 1
WHERE `POSTITION` > 2;
INSERT ...;
--
Sebastian