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

  • SEARCH
  • Home
  • 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 5968361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:04:44+00:00 2026-05-22T20:04:44+00:00

I have a query that is created in VBA and selects column information from

  • 0

I have a query that is created in VBA and selects column information from two other tables and creates a new table with that information.

Existing Query:

Select Prem.longitude, Prem.latitude,
DataByColl.[MIU ID], DataByColl.[Avg
RSSI], Prem.prem_addr1
Into [FifthAveMeshInput]
From [Prem]
Left
Join DataByColl
ON (Prem.meter_miu_id
= DataByColl.[MIU ID] AND DataByColl.Collector = (“Fifth Ave.”))
ORDER BY DataByColl.[Avg RSSI] desc

I would like to add to this two fields. One called Index that is auto incremented starting at a value of 2 as well as one called MeterType that is a number with all values set to 0. Is it possible to have all of these in one query or would I have to use separate queries to accomplish this? And if I would need to use separate queries which ones would I need and in what order?

  • 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-22T20:04:45+00:00Added an answer on May 22, 2026 at 8:04 pm

    Has to be two steps:

    1. Create the table (you can use SQL
      DDL CREATE TABLE... syntax for
      this).
    2. Populate the table using INSERT
      INTO..SELECT
      .

    One issue with the above is that you have to first discover the data types of the columns in your query and use them in the table creation step.

    Alternatively:

    1. Create the table using
      SELECT..INTO..FROM.
    2. Alter the table to add the new
      columns.

    One issue with the above is that you’d need to populate the auto-increment values yourself (if I am correct in thinking one can’t add the auto-increment property to an existing column), which may actually defeat the object of having an auto-increment column in the first place!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that pulls up questions from one table and answers from
I have a created a single LINQ query that creates a main group and
So I have a query that should get all posts from a table while
I have a query that I'm executing from a .NET application to a SQL
I have a query that I am generating the XML from in Oracle using
I have a query in Data Access Object DAOComments that joins users table and
I have created a query that uses a left join. For reasons I don't
So I have a MySQL query that is being created dynamically based on parameters
I have created a query that uses a decimal as a paramater in SSRS.
I have a query that is dynamically built after looking up a field list

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.