tags:

views:

30

answers:

1

Hello Im running a business and i have a mysql line problem that i cant get to function, I have a one line sql entry that im trying to join entrys from "tblCustomerCreditCards" and make them appear on a line im trying to draw from "tblCustomerAddresses"

my line for my tblCustomerAddresses is

select CustomerID,FullName,AddressLine1,City,ZipCode,PhoneNumber from tblCustomerAddresses

and my tblCustomerCreditCards is

select CustomerID,CardholderName,CardNumber,ExpirationMonth,ExpirationYear from tblCustomerCreditCards

my question is how will i get it so that my line from the creditcards comes at the end of the addresses where i can have it all on one line...

If possible can it be written in the format i have it as and not by breaking it down, your help is appreciated...Thanks very much

+2  A: 

Sounds like what you need is a simple join:

SELECT ca.CustomerID,FullName,AddressLine1,City,ZipCode,PhoneNumber,
       CardholderName,CardNumber,ExpirationMonth,ExpirationYear
FROM tblCustomerAddresses ca 
INNER JOIN tblCustomerCreditCards cc ON cc.CustomerID = ca.CustomerID

As a side note, I hope those credit card numbers are encrypted. Storing unencrypted credit card numbers is a really really big no-no.

Eric Petroelje
Im getting some type of error i don't know why, the program im using to extract info from my store gives it to my for some apparent reason..Is there anyway it could be written on a 1 line base or more simple maybe that will get it to work?
So glad you made the point about encrypting credit card numbers
HLGEM
@Barry - sorry, that's about as simple as it gets. What program are you using to extract the info from your store? and what is the error exactly? The more information we have, the better answer we can give you.
Eric Petroelje