I am writing a bash script to backup some information. I am currently a MySQL novice, but I figured out that I can find location(s) of this information by doing 2 SQL queries like:
"SELECT id FROM domains where name='$SITE' limit 1"
I then take the result of that ($DOMID) and use it in the other query like:
"SELECT name FROM data_bases where dom_id=$DOMID"
My question is can I combine the 2 queries to basically do something like:
"SELECT name FROM data_bases where dom_id=(SELECT id FROM domains where name='$SITE' limit 1)"
I am calling these from a bash script like:
mysql -usuer -ppassword -Ddatabase -e "SELECT ..."
So a related question would be, is there also a way to suppress the column labels and/or ASCII boxes around the output, so my parsing of the output would be easier?