Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6019789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:28:19+00:00 2026-05-23T03:28:19+00:00

Basically I’m trying to combine two tables together into a new table. The first

  • 0

Basically I’m trying to combine two tables together into a new table. The first table contains information on users and the second table stores information on purchases along with address specific information.

The end result would be a new updated table for Users that now includes addresses for each user (eg. zipcode, state, country) that will be merged from the Deals_Users_Assoc table.

Here’s the query that I have so far:

INSERT INTO NewUsers (User_ID, FirstName, LastName, City, StateProvince, Country, ZipCode, Username, Username_Clean, Password, Email, ActivationToken, LastActivationRequest, LostPasswordRequest, Active, Group_ID, SignUpDate, LastSignIn)

SELECT DISTINCT a.User_ID, a.FirstName, a.LastName, b.address_city, b.address_state, b.address_country, b.address_zip, a.Username, a.Username_Clean, a.Password, a.Email, a.ActivationToken, a.LastActivationRequest, a.LostPasswordRequest, a.Active, a.Group_ID, a.SignUpDate, a.LastSignIn

FROM Users a, Deals_Users_Assoc b

WHERE a.User_ID = b.user_id

GROUP BY a.User_ID;

It’s working, but only inserting data for users that are also stored in the Deals_Users_Assoc table (WHERE a.User_ID = b.user_id). Hundreds of user id’s are still remaining in the Users table.

Any help would be appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:28:20+00:00Added an answer on May 23, 2026 at 3:28 am

    Try to use SELECT query with LEFT JOIN clause –

    SELECT a.User_ID, a.FirstName, a.LastName, b.address_city, b.address_state, b.address_country, b.address_zip, a.Username, a.Username_Clean, a.Password, a.Email, a.ActivationToken, a.LastActivationRequest, a.LostPasswordRequest, a.Active, a.Group_ID, a.SignUpDate, a.LastSignIn
    FROM Users a
    LEFT JOIN Deals_Users_Assoc b
      ON a.User_ID = b.user_id
    GROUP BY a.User_ID;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically i've a table for my users (it's nightclub website) and now i'm trying
Basically, I'm trying to tap into the Soap pipeline in .NET 2.0 - I
Basically I have two models: User and Godfather. The godfather table has three columns:
Basically what I want to do it this: a pdb file contains a location
Basically, something better than this: <input type=file name=myfile size=50> First of all, the browse
Basically I am trying to restart a service from a php web page. Here
Basically I'm trying to accomplish the same thing that mailto:bgates@microsoft.com does in Internet Explorer
Basically, what I'm trying to create is a page of div tags, each has
Basically I'm attempting to add rows to a table, I need to do this
Basically what I'm trying to do is make a very simple vertical bullet projectile

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.