sql to show two addresses

  • Hi,

    If a person has got two addresses then I need post a letter for both the addresses otherwise post to the letter to the family address which is one.

    SELECT id,

    ,firstname

    ,lastname

    ,address

    ,postcode

    ,email

    From constituent

    The data I have is as below:

    10001,Esther,Wheels,101 Rosehill, WA1878,sue.w@hotmail.com

    10001,Esther,wheels,30 miles rd, 123UDF,hws.isthe@hotmail.com

    10001,Esther,Wheels,101 Rosehill, WA1878,

    How to put this information in a single row showing id,firstname,lastname, address1,postcode1,address2,postcode2,email1,email2,First Family(flag), Second family(x)? If there is no second address it should show just one address.

    Please help?

  • How to put this information in a single row showing id,firstname,lastname, address1,postcode1,address2,postcode2,email1,email2,First Family(flag), Second family(x)? If there is no second address it should show just one address.

    What do First Family(flag) and Second family(x) signify?

    Are you condensing to a single row based on the Id column? So one row required for every Id?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Please post the DDL for the table and an insert statement for data. (CREATE TABLE and INSERT..VALUES)

    This will help us help you find a solution. Show the results you would like, given the sample data and any queries you've tried.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply