Inserting last auto-generated ids

Vbanoob98

Board Regular
Joined
Sep 13, 2019
Messages
62
Yes thats very useful. How can I do this for lets say 200 rows instead of just 1? Or will this do it for all the rows?

And how could I join the result to my other table? :)
 

xenou

MrExcel MVP, Moderator
Joined
Mar 2, 2007
Messages
16,553
Office Version
2013
Platform
Windows
Possibly you are looking for something like this if you want to join two tables - where Table2 has the ID

Code:
select t2.ID, t1.Name, t1.Amount, t1.Address, t1,Total
 from Table1 t1
 inner join Table2 t2
on t1.Name = t2.Name
and t1.Amount = t2.Amount
and t1.Address = t2.Address
and t1.Total = t2.Total
 

Vbanoob98

Board Regular
Joined
Sep 13, 2019
Messages
62
Possibly you are looking for something like this if you want to join two tables - where Table2 has the ID

Code:
select t2.ID, t1.Name, t1.Amount, t1.Address, t1,Total
from Table1 t1
inner join Table2 t2
on t1.Name = t2.Name
and t1.Amount = t2.Amount
and t1.Address = t2.Address
and t1.Total = t2.Total
Thank you, I will try this tomorrow.
 

Vbanoob98

Board Regular
Joined
Sep 13, 2019
Messages
62
Possibly you are looking for something like this if you want to join two tables - where Table2 has the ID

Code:
select t2.ID, t1.Name, t1.Amount, t1.Address, t1,Total
from Table1 t1
inner join Table2 t2
on t1.Name = t2.Name
and t1.Amount = t2.Amount
and t1.Address = t2.Address
and t1.Total = t2.Total
I've been playing with this and it seems it requieres a unique identifier to work properly? Because when I put all the fields it just returns the headers.
 

Vbanoob98

Board Regular
Joined
Sep 13, 2019
Messages
62
I've been playing with this and it seems it requieres a unique identifier to work properly? Because when I put all the fields it just returns the headers.
I do have blank cells in both tables, Im guessing thats the issue
 

xenou

MrExcel MVP, Moderator
Joined
Mar 2, 2007
Messages
16,553
Office Version
2013
Platform
Windows
When you say it just returns the headers that means that the query resulted in no records (an empty set). That suggests that there is no match on the join criteria. You may need to examine one or two examples you think should be in the result and work out why they were excluded based on the join criteria. I'm doing a lot of guessing about your data - not able to say anything specific without an some sample data.
 

Forum statistics

Threads
1,082,306
Messages
5,364,414
Members
400,801
Latest member
julievandermeulen

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top