Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Gia Hoang Nguyen](https://secure.gravatar.com/avatar/8960e81396e01d4702c07bf58db6011b?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Gia Hoang Nguyen
4,137 PointsHow to reset the MakeID with the correct order ID?
Select ForeignMakeID As ID, MakeName As GlobalMake From ForeignMake Union Select MakeID, MakeName From Make;
This will return all Foreign and Domestic Make but the ID has some duplicate number.
Is it possible to set the MakeID in the correct order without having any duplicate?
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsFrom the database perspective, these aren't duplicates because either the name or number is different. If you want to display all the make names without duplicates, just leave off the id number:
SELECT MakeName AS GlobalMake FROM ForeignMake UNION SELECT MakeName FROM Make;
But with a subquery, you could combine the ID's into one column and use grouping to eliminate the duplicates:
SELECT group_concat(ID, ", ") AS IDs, GlobalMake FROM
(SELECT ForeignMakeID||"F" AS ID, MakeName AS GlobalMake FROM ForeignMake
UNION ALL SELECT MakeID||"M", MakeName FROM Make)
GROUP BY GlobalMake
Since the ID's are associated with a particular table, I concatenated a letter onto each one to identify which table it applies to.
![Gia Hoang Nguyen](https://secure.gravatar.com/avatar/8960e81396e01d4702c07bf58db6011b?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Gia Hoang Nguyen
4,137 PointsAwesome!