Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Sql Server Programming

Query combine column from 2 tables


I have 2 tables, both of which contain a zipcode.

Table A                   Table B
ZipCode char(5)           ZipCode char(5)

I would like to generate something like this:

select distinct(distinct(a.ZipCode) + distinct(b.ZipCode)) ZipCode

but I don't have a clue how to do this. I want a single column combining
the columns from both tables containing distinct values for ZipCode.

TIA, Flomo
--

hi

Can you post Table A and Table b DDL script?

Vt
Knowledge is power;Share it
http://oneplace4sql.blogspot.com

"Flomo Togba Kwele" <F@community.nospam> wrote in message
news:xn0f74m156b55e000@news.giganews.com...

CREATE TABLE [dbo].[A](
        [MailPendingGroupID] [int] NOT NULL,
        [Zip] [char](5) NOT NULL,
        [Count] [int] NOT NULL,
        [CountMailed] [int] NOT NULL,
        [AmtMailed] [decimal](9, 3) NOT NULL,
        [dateAdded] [smalldatetime] NOT NULL,
 CONSTRAINT [PK_MailPendingGroupGenSpec] PRIMARY KEY CLUSTERED
(
        [MailPendingGroupID] ASC,
        [Zip] ASC
)

CREATE TABLE [dbo].[B](
        [MailPendingGroupID] [int] NOT NULL,
        [Zip] [char](5) NOT NULL,
        [Cost] [int],
        [dateAdded] [smalldatetime] NOT NULL,
 CONSTRAINT [PK_MailPendingGroupDaily] PRIMARY KEY CLUSTERED
(
        [MailPendingGroupID] ASC,
        [Zip] ASC
)
--

On 6 7 ,   12 58 , "Flomo Togba Kwele" <F@community.nospam> wrote:

Make a guess and I hope this can help you :)
SELECT
A.*,A.ZipCode + B.ZipCode AS ZipCodeC
FROM A JOIN B ON A.MailPendingGroupID = B.MailPendingGroupID
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc