0
votes

Erreur de syntaxe sur la fonction Concat en ordre

Affichage d'une erreur de syntaxe comme

1064-Vous avez une erreur dans votre syntaxe SQL.check le manuel qui correspond à votre version de serveur Maria DB pour la bonne syntaxe utilisée de
Résidentiel_no regexp ('^ [0-9]') Desc, casting (résidentiel_no comme non signé), Regexp_substr (résidentiel_no, '(^ [A-Za-Z] +) | ([A-ZA-Z] $)') , Casting (regexp_substr (résidentiel_no, '(^ [0-9] +) | ([0-9] + $)') Comme non signé xxx


2 commentaires

Et si vous modifiez l'Apostrophe dans tous vos Regexp de ' sur "?


Essayé ça mais sa ne montre aucun résultat @ tcadidot0


3 Réponses :


0
votes

Si vous voulez vérifier l'index pour CUS_ID, essayez d'utiliser la séquence de devis (la valeur de la valeur de Concat est déjà une chaîne de virgule séparée) xxx


0 commentaires

0
votes

Essayez cette requête si elle fonctionnera: xxx pré>

modifié le '' code> sur " code> dans tout le regexpl Condition. P>

EDIT: Dans inverse " code> à ' code>. p>

 CONCAT("SELECT a.*,g.assoc_name,c.ward_name,d.team_ld_name,e.volunteer_name,f.scheme_name FROM ttb_customer a left join ttb_association g on g.assoc_id=a.assoc_id
left join ttb_ward c on c.ward_id=a.ward_id left join ttb_team_lead d on d.tm_id=a.team_lead_id left join
ttb_volunteer e on e.volntr_id=a.volnt_id left join ttb_scheme f on f.scheme_id=a.scheme_id WHERE NOT  FIND_IN_SET(a.cust_id,'",cus_id,"') > 0 ORDER BY b.assoc_name asc,  residential_no REGEXP ('^[0-9]') DESC,CAST(residential_no AS UNSIGNED),REGEXP_SUBSTR(residential_no, '(^[a-zA-Z]+)|([a-zA-Z]$)'),CAST(REGEXP_SUBSTR(residential_no, '(^[0-9]+)|([0-9]+$)') AS UNSIGNED")


6 commentaires

Essayé ça mais sa ne montre aucun résultat - aucune erreur mais pas de résultat @ tcadidot00


J'ai essayé de changer de regexp ('^ [0-9]') à regex ("^ [0-9]") dans ma requête de test sur mariadb 10.3 Il fait Résultat de retour. Peut-être que notre état n'est pas similaire.


Peut-être qu'en retour? Vérifier ma deuxième annonce de requête


Sélectionnez un. *, g.assoc_name, c.ward_name, d.team_ld_name, f.schemeer_name, f.scheme_name à partir de ttb_customer A rejeter gauche ttb_association g sur g.assoc_id = A.assoc_id À gauche Joindre TTB_Ward C sur c. ward_id = a.ward_id gauche rejoignez ttb_team_lead d sur d.tm_id = a.team_lead_id de gauche rejoignez ttb_volunteer e sur e.volntr_id = a.volnt_id de gauche rejoignez ttb_scheme f sur f.scheme_id = a.scheme_id ordre par b.assoc_name ASC, Résidentiel_NO REGEXP ('^ [0-9]') Desc, cast (résidentiel_no comme non signé), Regexp_substr (résidentiel_no, '(^ [A-Za-Z] +) | ([A-ZA-Z] $)'), Cast (Regexp_substr (résidentiel_n o, '(^ [0-9] +) | ([0-9] + $)') Comme non signé si vous exécutez ceci?


Cette requête est ok mais quand elle est sous concaxe, sa syntaxe d'affichage @ tcadidot00


Vous voulez dire si vous exécutez la requête ci-dessus directement sur le serveur, il retournera le résultat? Si tel est le cas, vous devez peut-être vérifier votre clause. Pour le Concat , vous pouvez supprimer cette partie où ne figure pas figurant_in_set (a.cust_id, '", cus_id,"')> 0



0
votes

Essayez ceci

​​ p>

CREATE DEFINER=`root`@`localhost` PROCEDURE `checking`(IN `mnth` int,IN `yr` int)
BEGIN
DECLARE cus_id text;
DECLARE pat varchar(20);
DECLARE pats varchar(40);
DECLARE patss varchar(40);
SET pat ='^[0-9]';
SET pats ='(^[a-zA-Z]+)|([a-zA-Z]$)';
SET patss ='(^[0-9]+)|([0-9]+$)';
BEGIN
ROLLBACK;
END;
SELECT GROUP_CONCAT(DISTINCT b.cust_id) FROM ttb__customer_billing b WHERE b.month_id IN (mnth) and year_id=yr   INTO cus_id;
SET @qry = CONCAT('SELECT a.*,g.assoc_name,c.ward_name,d.team_ld_name,e.volunteer_name,f.scheme_name FROM ttb_customer a left join ttb_association g on g.assoc_id=a.assoc_id
left join ttb_ward c on c.ward_id=a.ward_id left join ttb_team_lead d on d.tm_id=a.team_lead_id left join
ttb_volunteer e on e.volntr_id=a.volnt_id left join ttb_scheme f on f.scheme_id=a.scheme_id WHERE NOT  FIND_IN_SET(a.cust_id,"',cus_id,'") > 0 ORDER BY b.assoc_name asc, a.residential_no REGEXP ("',pat,'") DESC,CAST(a.residential_no AS UNSIGNED),REGEXP_SUBSTR(a.residential_no, "',pats,'"),CAST(REGEXP_SUBSTR(a.residential_no, "',patss,'") AS UNSIGNED)');
PREPARE stmt FROM @qry;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END


0 commentaires