473,624 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query from First Table, relation in second Table

1 New Member
Hi Friends,

I have two tables, second table has relation

Table1:
----------
Id
----------
A01
A02
A03
A04
A05

Table2
-----------
sid pid
----------
A01 A01
A02 A01


If I use Query table1.id = 'A01', I need to have A01 and A02.
If I use Query table1.id = 'A02', I need to have A01 and A02.
but If I use Query table1.id = 'A03' , need to have only A03

It means A01 and A02 are duplicates. I want to extract duplicates.

Can you help me to get SQL query?

Thanks,
Ashok
Nov 18 '08 #1
2 1682
Dormilich
8,658 Recognized Expert Moderator Expert
I've heard there's some kind of duplicate keyword in sql. anyway, you should ask a moderator to move your thread to the sql forum, since your problem seems to be more of sql than php.

regards
Nov 18 '08 #2
Atli
5,058 Recognized Expert Expert
Hi.

I have moved this thread over to the MySQL forum.
Please try to post your questions in the appropriate forums.
(See How To Ask A Question)

If you are in fact not using MySQL, but rather some other SQL server, let me know and I will relocate the thread to the proper forum.

Thank you,
Moderator
Nov 18 '08 #3

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

Similar topics

13
5549
by: aaron | last post by:
I have a question about (i think) joining. If I have a table in a database that has this info: key - name - favorite 1 - john - 2 2 - judy - 3 3 - joe - 1 the favorite icecream table is this:
1
9116
by: ahaideb | last post by:
I have a table (relation) in my database: --------------- | parent | child | --------------- | 1 | 2 | | 1 | 3 | | 2 | 4 | | 2 | 5 | | 3 | 6 |
7
10800
by: Bing Wu | last post by:
Hi Folks, I have a very large table containing 170 million rows of coordinats: CREATE TABLE "DB2ADMIN"."COORDINATE" ( "FID" INTEGER NOT NULL , "AID" INTEGER NOT NULL , "X" REAL NOT NULL , "Y" REAL NOT NULL , "Z" REAL NOT NULL )
1
3683
by: Robert Marshall | last post by:
Hi all, Hoping someone can help me with an issue I'm having. I'm using AccessXP to create a database of U.S. Census records. After keying the data in, I decided to run a query to create a report for each domocile address, and the three names that appear at each street address for the three censii. After running the query, the report skips over any "address" that
3
1857
by: pw | last post by:
Hi, I am having a mental block trying to figure out how to code this. Two tables: "tblQuestions" (fields = quesnum, questype, question) "tblAnswers" (fields = clientnum, quesnum, questype, answer) They are related by quesnum and questype. There are records in
25
2240
by: frizzle | last post by:
Hi there, I have a mySQL system with a news publishing part in it: Admins can create new items with text in it, and they have an option to create 'fulltexts', so you'd get "read more ..." on the front page, click it and read the fulltext. Is there a possibility for mySQL (query) to check if 'fulltext' is empty or not, and only return true or false, so i don't have to put the whole fulltext into the mysql_fetch_array() to decide wether...
4
3389
by: Miks | last post by:
The database scheme consists of four relations: Product(maker, model, type) PC(code, model, speed, ram, hd, cd, price) Laptop(code, model, speed, ram, hd, screen, price) Printer(code, model, color, type, price) The relation "Product" shows the maker, model number, and type (pc, laptop, or printer). It is assumed that model numbers are unique for all the makers and product types. For each model number specifying pc
5
3838
by: wugon.net | last post by:
question: db2 LUW V8 UNION ALL with table function month() have bad query performance Env: db2 LUW V8 + FP14 Problem : We have history data from 2005/01/01 ~ 2007/05/xx in single big table, we try separate this big table into twelve tables and create a view
1
1724
by: Coll | last post by:
I'm working on a database that someone else created. I have a form - frm_main that is based on a query that is based on two tables. The join is such that the first table tbl_JCN has all records included in the query, but the second table tbl_SOC only has matching records displayed. On the form (frm_main), there is a combo box - you can make a selection and the form filters to display that record. There is also a delete record button. When...
0
8233
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8619
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8334
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6108
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2604
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.