ausführen von mysql-Abfragen in shell-Skript

Angenommen ich habe 2 Datenbanken nm und nm_history. Ich brauche zum abrufen von Datensätzen aus beiden Datenbanken.wenn ich execute query in mysql, seine Arbeitsmethoden in Ordnung. Aber wenn ich ausführen, die Abfrage in der bin/bash gibt es folgenden Fehler

**

mysql: option '-e' requires an argument
./get_rec.sh: line 4: subscriber_2: command not found
./get_rec.sh: line 4: a_party: command not found
./get_rec.sh: line 4: subscriber_2: command not found
./get_rec.sh: line 4: prov_channel: command not found
./get_rec.sh: line 4: subscriber_2: command not found
./get_rec.sh: line 4: created: command not found
./get_rec.sh: line 4: svc_mgmt_07: command not found
./get_rec.sh: line 4: created: command not found
./get_rec.sh: line 4: subscriber_2: command not found
./get_rec.sh: line 4: svc_mgmt_07: command not found
./get_rec.sh: line 4: subscriber_2: command not found
./get_rec.sh: line 4: a_party: command not found
./get_rec.sh: line 4: svc_mgmt_07: command not found
./get_rec.sh: line 4: msisdn: command not found
./get_rec.sh: line 4: svc_mgmt_07: command not found
./get_rec.sh: line 4: action_type: command not found
./get_rec.sh: line 4: SELECT nm.., nm.., nm.. AS Created, nm_history.. AS terminate FROM nm. INNER JOIN nm_history.  ON nm.. = nm_history..
WHERE nm_history..=2: command not found

**

hier ist das Skript:

mysql -uUser -pPassword -hHostDB -e

Abfrage:

SELECT S.`a_party`, S.`prov_channel`, S.`created` AS Created,M.`created` AS terminate FROM nm.`subscriber_1` S INNER JOIN nm_history.`svc_mgmt_06` M ON S.`a_party` = M.`msisdn` 
WHERE M.`action_type`=2;**

InformationsquelleAutor user3189059 | 2014-07-03

Schreibe einen Kommentar