Mandi! Dombre Julien
  In chel di` si favelave...

> > SELECT glpi_computers.ID, glpi_computers.name, glpi_computers.serial,
> >     glpi_computers.otherserial, glpi_computers.contact,
> >     glpi_computers.contact_num, glpi_infocoms.buy_date,
> >     glpi_infocoms.use_date, glpi_infocoms.warranty_duration,
> >     glpi_infocoms.num_commande, glpi_infocoms.bon_livraison,
> >     glpi_infocoms.num_immo
> > FROM glpi_computers LEFT JOIN glpi_infocoms
> >     ON glpi_computers.ID = glpi_infocoms.FK_device
> > WHERE ((glpi_infocoms.device_type=1) OR (glpi_infocoms.device_type is 
> > NULL))
> > ORDER BY glpi_computers.ID;

> *71 over 119 ?
> we do not know your datas.
> How can we help you without knowing your datas ?

...because this seems to me a rather ``simple'' LEFT JOIN query,
involving only glpi_computers and  glpi_infocoms table, where
glpi_infocoms misses some data (so, the left join).


> Where do you get this request ? It is a home made one ?

yes. home made. ;)


> Please send comprehensive requests (what, why, where, who ?).

...but i think i've found the clue. The condition
(glpi_infocoms.device_type=1) that select computers came after th LEFT
JOIN clause, and so i have three types of records:

1) computer that have a matching infocom of computers type
2) computer that have a matching infocom NOT of computers type
3) computer that NOT have a matching infocom (and so
 glpi_infocoms.device_type is NULL).

after that the condition ((glpi_infocoms.device_type=1) OR
(glpi_infocoms.device_type is NULL)) matches only 1 and 3, missing 2.


Please, can the device_type field also be added to computers (and
clearly monitors, printers, ...) table? Clearly it is fully redundant,
but will help in query like these. ;)

-- 
dott. Marco Gaiarin                                 GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''                http://www.sv.lnf.it/
  Polo FVG  -  Via della Bont�, 7 - 33078  -  San Vito al Tagliamento (PN)
  marco.gaiarin(at)sv.lnf.it      tel +39-0434-842711  fax +39-0434-842797

_______________________________________________
Glpi-dev mailing list
[email protected]
https://mail.gna.org/listinfo/glpi-dev

Reply via email to