bonjour je me retrouve avec une requête assé balèze.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
INSERT INTO details_facture 
( 
  id_facture, 
  id_service, 
  prix_UHT, 
  prorata, 
  prix_HT, 
  prix_TVA, 
  payer, 
  date_achat 
) 
VALUES (   SELECT
    id_facture, 
    17, 
    sum(a_t.prix_HT), 
    0,
    sum(a_t.prix_HT), 
    ROUND(sum(a_t.prix_HT) * 0.196, 2), 
    3, 
    2010-06-01 
  FROM factures AS f 
  INNER JOIN membre AS m 
  ON m.id_membre = f.id_membre 
  INNER JOIN appels_telephoniques AS a_t 
  ON m.telephone = CONCAT('0', SUBSTRING(a_t.appelant, 4, 1), '.', SUBSTRING(a_t.appelant, 5, 2), '.', SUBSTRING(a_t.appelant, 7, 2), '.', SUBSTRING(a_t.appelant, 9, 2), '.', SUBSTRING(a_t.appelant, 11, 2)) 
  OR m.telephone_2 = CONCAT('0', SUBSTRING(a_t.appelant, 4, 1), '.', SUBSTRING(a_t.appelant, 5, 2), '.', SUBSTRING(a_t.appelant, 7, 2), '.', SUBSTRING(a_t.appelant, 9, 2), '.', SUBSTRING(a_t.appelant, 11, 2)) 
  OR m.telephone_3 = CONCAT('0', SUBSTRING(a_t.appelant, 4, 1), '.', SUBSTRING(a_t.appelant, 5, 2), '.', SUBSTRING(a_t.appelant, 7, 2), '.', SUBSTRING(a_t.appelant, 9, 2), '.', SUBSTRING(a_t.appelant, 11, 2)) 
  WHERE date_debut >= '2010-06-01' 
  AND date_debut <= '2010-06-30' 
  GROUP BY id_facture
)
il me sort qu'il y a une erreur à partir de "VALUES("

y a un moyen de faire se genre de requête ?