Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 11-09-06
Super Moderator
 
Join Date: Aug 2003
Posts: 1,984
Thanks: 1
Thanked 1 Time in 1 Post
Fraser seems to know their stuff
  Database Query help

I'm using MS Access and have two lists of users in two different tables but I want to run a query and get one combined list of users. Some might be in both tables but there are certain users that are only in one table or the other.

In some ways I don't think this is difficult but I can't quite get my head round how to do this in one query in access. Any advice?

An example table layout is

Table 1

id | user
----------
1 | abc
2 | def
3 | ghi

Table 2

id | user
----------
1 | abc
4 | jkl
5 | mno
2 | def
__________________
Fraser

Affiliate Blog & Podcast
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-09-06
Registered User
 
Join Date: Dec 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Tony Harrison is an unknown quantity at this point
use UNION.

Example:

Code:
select id, user from table1
union
select id, user from table2
Important to remember that with unions all columns must be of the same datatype (vertically).

You may want to have a look at your table structure, as if you get into that sort of situation you probably have a badly designed database.
__________________
Hair Supermarket - 10% on Webgains. tony @ sekl.co.uk
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-09-06
Super Moderator
 
Join Date: Aug 2003
Posts: 1,984
Thanks: 1
Thanked 1 Time in 1 Post
Fraser seems to know their stuff
ahh! That's the one - thanks

It is possible that it's not the best design of tables but at the moment I'm just picking up someone else's project and trying to get the right reports out of it so for the time being I'll let it go!
__________________
Fraser

Affiliate Blog & Podcast
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
mobile phone database DutchRomano The Affiliate Marketing Lounge 4 17-10-08 12:17 PM
mySQL - which is faster - 4 large tables in one database or a database for each? giveasyouget Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 6 21-01-07 04:30 PM
Affiliate links stored in a database Nigel Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 4 07-01-04 02:46 PM
MYSQL Query? Scottcage Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 4 16-05-03 08:56 PM


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7