sql server - SQL full outer join -


i busy completing old examiniation paper

one question reads follows:

study following tables , answer questions below:

create table cardholders( ch_id integer identity, ch_name varchar(50), ch_surname varchar(50), ch_idnumber char(13), ch_cardnumber char(13), ch_status char(2), ch_create_date datetime, ch_last_change_date datetime)  cardholder_status //apologies if wrongly formatted  chs_status  chs_description 00          active 01          not active 

write query obtain following results

cardholder  status ashton, t   active brown, c    active crawford, c not active ellis, j    active 

i assume have make use of full outer join since no colum matches in 2 tables. wrote piece of code, giving me syntax error.

select ch_name, ch_surname cardholders full outer join  on cardholder_status.chs_status, cardholder_status.chs_description 
  • am on right path or logic wrong?
  • am right in using outer join, alternative join use?
  • how can extract first letter ch_name use initial?

without seeing example data, expect followign "just work":

select      ch.ch_surname + ', ' + left(ch.ch_name, 1) cardholder,             chs.chs_description status         cardholders ch  inner join  cardholder_status chs     on      chs.chs_status = ch.ch_status 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -