Rookie SQL Question

  • Thread starter Thread starter Ivan Sammut
  • Start date Start date
I

Ivan Sammut

Hi,

This is a dump question most proably but totally fogot the SQL commands an
need a refresh. I have a table containing a list of cutomers (pcst), then I
have an other table (pcstmes) which contains some details about some of the
customer not all. The 2 tables are related by a fields named account.

I did an sql statment to select all the records from the the pcst and also
the records from pcstmes but somehow I am only getting those records which
have an entry in both tables. This is my SQL statment

"select pcst.name, pcst.tel, pcstmes.sline_1 from pcst,pcstmes where
pcst.Account= pcstmes.Account and pcst.Account = @sAcc"

I have something wrong in this line pcst.Account= pcstmes.Account
Anyone has an idea what I'm doing wrong.

Ivan
 
Let's use OUTER JOIN instead of INNER JOIN.

select pcst.name, pcst.tel, pcstmes.sline_1 from
pcst left join pcstmes on pcst.Account= pcstmes.Account
where pcst.Account = @sAcc

Thi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top