Re: Select unique based on 4 field values
On Jun 28, 6:36 am, semi_e...@inbox.com wrote:
> On Jun 26, 10:41 pm, "Paul Lautman" <paul.laut...@btinternet.com>
> wrote:
>
>
>
> > Can you add a primary key? If so add an auto-increment primary key column
> > and then you can use the Strawberry Query to do what you want. You haven't
> > given any names for the columns so I am going to assume that the table is
> > called bad_table the float columns are f1, f2, f3, f4 and the primary key
> > you will add is called id:
>
> > SELECT
> > `b2`.`*`
> > FROM `bad_table` `b1`
> > LEFT JOIN `bad_table` `b2` ON `b1`.`f`1` = `b2`.`f`1` AND `b1`.`f`2` =
> > `b2`.`f`2` AND `b1`.`f`3` = `b2`.`f`3` AND `b1`.`f`4` = `b2`.`f`4` AND
> > `b1`.`id` < `b2`.`id`
> > WHERE `b1`.`id` IS NULL
>
> That worked! Funny name. The table shrunk about 75%, I've combined all
> the char fields into a single field now and added some PHP logic to
> map user selections to a corresponding db row. Performance is
> acceptable now.
>
> Thanks for the help.
What's 'funny' about it? ;-)
|