473,322 Members | 1,401 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,322 software developers and data experts.

Join query with foreign key

Hi,

How to use foreign key with join queries. I have used the query

SELECT first_name,last_name,user_email from Info,Registry WHERE user_id='1';

where user_id = foreign key
first_name,last_name are in table Info
user_email in table Registry
user_id is a foreign key which references the parent key present in seperate database.
The query is returning empty set even though there are results in mysql table.

What is the reason for this. Can anyone help me.

Thanks
Feb 2 '08 #1
1 1229
amitpatel66
2,367 Expert 2GB
Hi,

How to use foreign key with join queries. I have used the query

SELECT first_name,last_name,user_email from Info,Registry WHERE user_id='1';

where user_id = foreign key
first_name,last_name are in table Info
user_email in table Registry
user_id is a foreign key which references the parent key present in seperate database.
The query is returning empty set even though there are results in mysql table.

What is the reason for this. Can anyone help me.

Thanks
1. You have used two tables info and registry, but what is the join between those two tables?
2. We can use foreign key column in where conditions as we use any other column, there is no rules or any different method of using a foreign key column in where condition!!
Feb 2 '08 #2

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

Similar topics

0
by: Marek Lewczuk | last post by:
Hello, I have a strange problem, maybe some of you will be able to explain me something. I use LEFT JOIN as a substitute for subselects. It's true that many subselects can be rewriten using LEFT...
1
by: Paul Bramscher | last post by:
Here's one for pathological SQL programmers. I've got a table of things called elements. They're components, sort of like amino acids, which come together to form complex web pages -- as nodes...
6
by: Rowan | last post by:
Hello, I am having a problem with a join. Either I am just not seeing the obvious, it isn't possible, or I need to use a different approach. I have an application with a vsflexgrid that needs...
7
by: Pino | last post by:
Hi, to everybody, let's consider this scenario: you have 1 data-table and 10 dictionary-tables; the data-table has 5 million records and 30 columns, 10 of these columns have a foreign-key to the...
1
by: Justin | last post by:
Hello, I have a scenario where I have unique identifiers in about 25 tables, each table has varying fields - eg. Table #1 Table #2 Table #3 Table #4 --------- ...
6
by: PW | last post by:
I've created an ASP application which uses an Access database. I've created an outer join query, but for some reason the "Property_Def" column is not aligning with the "ESPN" column. They should...
5
by: Dot Net Daddy | last post by:
Hello, I have set up a database for movies. In one table (Movies) I have movie names, and production years, and also genres. In another table (Directors), I keep the directors and the movies...
1
by: Simon Gare | last post by:
Hi all, having problem with query below SELECT DISTINCT dbo.logon.DRIVER_NO, dbo.booking_form.DriverNo FROM ((dbo.logon RIGHT JOIN dbo.Employees ON dbo.logon.DRIVER_NO =...
1
by: teser3 | last post by:
I have 3 Access 2003 tables: TableMain MID PO TE INFO 1 2 3 ABC 2 2 1 EREER 3 1 3 OIUOI 4 3 3 PERE 5 2 2 DFE
2
by: gubbachchi | last post by:
Hi, How to use foreign key with join queries. I have used the query SELECT first_name,last_name,user_email from Info,Registry WHERE user_id='1'; where user_id = foreign key...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.