Skip to content

Commit

Permalink
Inner join
Browse files Browse the repository at this point in the history
  • Loading branch information
apuyou committed Oct 4, 2013
1 parent 4d42f16 commit 7ebcad1
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/Payutc/Bom/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,12 @@ public function getHistorique() {
fun.fun_name AS fun,
NULL AS firstname,
NULL AS lastname
FROM
t_purchase_pur pur,
t_object_obj obj,
t_fundation_fun fun,
t_application_app app
FROM
t_purchase_pur pur
INNER JOIN t_object_obj obj ON pur.obj_id = obj.obj_id
INNER JOIN t_fundation_fun fun ON pur.fun_id = fun.fun_id
WHERE
pur.usr_id_buyer = ?
AND pur.obj_id = obj.obj_id
AND pur.fun_id = fun.fun_id
UNION ALL
SELECT
rec.rec_date AS date,
Expand All @@ -239,11 +236,10 @@ public function getHistorique() {
usrfrom.usr_firstname AS firstname,
usrfrom.usr_lastname AS lastname
FROM
t_virement_vir virin,
ts_user_usr usrfrom
t_virement_vir virin
INNER JOIN ts_user_usr usrfrom ON virin.usr_id_from = usrfrom.usr_id
WHERE
virin.usr_id_to = ?
AND virin.usr_id_from = usrfrom.usr_id
UNION ALL
SELECT
virout.vir_date AS date,
Expand All @@ -254,11 +250,10 @@ public function getHistorique() {
usrto.usr_firstname AS firstname,
usrto.usr_lastname AS lastname
FROM
t_virement_vir virout,
ts_user_usr usrto
t_virement_vir virout
INNER JOIN ts_user_usr usrto ON virout.usr_id_to = usrto.usr_id
WHERE
virout.usr_id_from = ?
AND virout.usr_id_to = usrto.usr_id
ORDER BY `date` DESC',
array($this->getId(), $this->getId(), $this->getId(), $this->getId()),
array("integer", "integer", "integer", "integer")
Expand Down

0 comments on commit 7ebcad1

Please sign in to comment.