473,395 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Retrieve columns in multiple table where some columns are in both tables

I want retrieve columns x,y,z. Where x and y are in both tables A and B but z is only in table B. Any ideas? I keep getting x and y are ambiguous.
Feb 21 '14 #1
3 1147
Rabbit
12,516 Expert Mod 8TB
You need to show us your code.

But that error means it doesn't know which x and which y you want. You need to qualify the table.
Feb 21 '14 #2
The code is simple
SELECT x,y,z
FROM A,B
I tried UNION but that does not work since the data is too different.
Feb 24 '14 #3
Rabbit
12,516 Expert Mod 8TB
The problem is basically what I described in my first post. You need to qualify your tables. It doesn't know which table you want the x and y from. And if you want it from both tables, you need the include them twice, each qualified for the tables.

Also, you're doing a cartesian join, are you sure you want to do that? that will multiply every row from one table with every row from the other table. You need to join the table on the key field to prevent that.

If however you are looking to append the two separate sets of records together, then you need to use a UNION. You said it doesn't work because the data is too different. All you need to do then is make it the same by converting the data.
Feb 24 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ray | last post by:
Hello all, I am attempting to delete multiple rows from multiple tables as follows: DELETE FROM attachments,responses,response_lines WHERE attachments.id IN(2,7,11) AND...
4
by: Indra | last post by:
Hi There, I am looking for information on how to import the txt or csv file to the multiple table in sql 2000. If you have any kind of inf. please let me know wheather we can do this and how. ...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
5
by: Jeremy | last post by:
This is a variation on the last 2 unresolved questions I've posted. Having removed the "required" attribute from a field that was causing trouble, I'm finding that my dataAdapter update gets...
8
by: JReneau35 | last post by:
I am a novice to MS Access. I have about 10 to 15 tables that link to a single form. I use unique ID's to link all of these tables together. Since the ID for the customer never changes, I was...
5
by: fruityfreak | last post by:
I would like to know how to I retrieve information from another database table... Instead of keying in manually, I would like to retrieve data directly from the logged in user row. For the user...
2
parshupooja
by: parshupooja | last post by:
Hello , I am using asp.net C# SQL Server . I have form on asp.net page consists various fields. field 1, field 2 ------ upto field 10 on click of submit button i need to save all information...
0
by: madhanmss | last post by:
Hi, How to freeze multiple rows and columns in a datagrid. It should be like an excel sheet, if you scroll horizontally, columns should be freezed and if u scroll vertically, rows should be...
2
TheServant
by: TheServant | last post by:
Hi everybody, I posted a similar question about 6~12 months ago with no definate answer, so I will give it another go, as the choice has popped up again in my programming life: If the number of...
0
by: kalinda | last post by:
I am trying to make multiple joins between two tables and am at a loss. I've tried a variety of things with this being the latest, but it pulls all records multiple times. Basically I have a main...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.