MySQL command line help

rumpeltumskin

Member
Oct 17, 2008
33
0
0
I want to make a stored procedure from calling the customer_id number off a table. I want to make this select to make a mailing address for the customer including business name, address, city, state and zip code, but I can not figure out how to produce the info in 3 lines like a normal mailing address

here's a made up sample of the format of the table table, any help would be great

+-------------+-----------------------+-------------------+-----------------+-------+-------+---------------------+-------------------+--------+-------+------+--------+-------+------+----------+------------+--------+-----------+---------+
| customer_id | customer_name | address | city | state | zip | email | url | acodep | xchgp | nump | acodef | xchgf | numf | poc_tit | poc_fname | poc_mi | poc_lname | poc_suf |
+-------------+-----------------------+-------------------+-----------------+-------+-------+---------------------+-------------------+--------+-------+------+--------+-------+------+----------+------------+--------+-----------+---------+
| 1 | Lowes | 3445 Elm Street | Bryan | TX | 77802 | sales@lowes.com | www.lowes.com | 979 | 856 | 5433 | 979 | 556 | 5432 | manager | James | T | Kirk | NULL |
| 2 | Home Depot | 234 2nd Street | College Station | TX | 77801 | sales@homedepot.com | www.homedepot.com | 979 | 565 | 3323 | 979 | 565 | 3322 | salesman | Jonathan | NULL | Archer | NULL |
| 3 | D-Square | 4554 High Avenue | College Station | TX | 77801 | sales@d-square.com | www.d-square.com | 979 | 268 | 5789 | 979 | 268 | 5788 | manager | Montgomery | NULL | Scott | NULL |
| 4 | Construction Supplies | 12 Mosswood Drive | Conroe | TX | 76572 | sales@consupp.com | www.consupp.com | 979 | 453 | 3345 | 979 | 453 | 3346 | manager | Katherine | NULL | Janeway | NULL |
+-------------+-----------------------+-------------------+-----------------+-------+-------+---------------------+-------------------+--------+-------+------+--------+-------+------+----------+------------+--------+-----------+---------+
 

Ka0t1x

Golden Member
Jan 23, 2004
1,724
0
71
If you're pulling data directly from command line I would have no idea.

You could insert line breaks for html or for text editors (<br />, \r\n
 
Last edited:

Ka0t1x

Golden Member
Jan 23, 2004
1,724
0
71
For some reason it killed the rest of my post... After I
 
Last edited:

a123456

Senior member
Oct 26, 2006
885
0
0
This is probably not what you want, but could you make a super ghetto hack with the select?

Something like
select concat(customer_name, '\n', address, '\n', city, ', ', state, ' ', zip) from blah where blah

Substitute <br> for \n if HTML is needed.
 

Ka0t1x

Golden Member
Jan 23, 2004
1,724
0
71
+1

It seems like something is happening to my posts after posting, but that's exactly what I was trying to post.