Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index

On 01/23/2012 08:26 AM, Werner F. Bruhin wrote:
I have the following:

- id
- name

- id
- type
- total
- tablea_id

In tableb there can be multiple records for a record in tablea.

Like to get to this:,, tableb1.total1 (if type = 1), tableb2.total2 (if type = 2)

I tried to setup a view where I link tableb twice to tablea, but I can't figure out how to define things with regards to the relation.

In SQL it would be something along these lines:

SELECT DISTINCT `table1`.`name`, `tableb1`.`total`, `tableb2`.`total` FROM `tablea` LEFT OUTER JOIN `tableb` as `tableb1` ON `tablea`.`id` = `tableb1`.`tablea_id` AND `tableb1`.`type` = 1 LEFT OUTER JOIN `tableb` as `tableb2` ON `tablea`.`id` = `tableb2`.`tablea_id` AND `tableb2`.`type` = 1

Is this possible with base in LibrOffice 3.3.2, but could upgrade if a newer version provides this functionality.

Thanks in advance for any tips.

I'm no guru, and I just thought about it in my head. So it will definitely not work...

    (SELECT total FROM tableb WHERE type = 1 LIMIT 1) AS `Type1 Total`,
    (SELECT total FROM tableb WHERE type = 2 LIMIT 1) AS `Type2 Total`
    tablea, tableb
WHERE = tableb.tablea_id;


For unsubscribe instructions e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.