Hi,
I've a table named PC as below: PC(code, model, speed, ram, hd, cd, price) I want to write a query to find the pairs of PC models having similar speeds and RAM. Also, in the result set, the pairs of PC's being compared should occur only once, i.e, if (i,j) is compared then (j,i) shouldn't be compared. Plz help me solve this query.
Thanks,
Babu
3 1907
dear mate, it is fair to show some of what you have done and what you have got so that you are needing help... with no offence, else it just looks like many of us are doing your homeworks where you are not putting effort at all. ok? -
SELECT DISTINCT(p.model), p.speed, p.ram
-
FROM pc p, pc q
-
WHERE p.speed=q.speed AND p.ram=q.ram AND p.model!=q.model
-
ORDER BY p.model;
-
hope that helps you...
cheers mate!
SELECT DISTINCT p.model,,q.model, p.speed, p.ram
FROM pc p, pc q
WHERE p.speed=q.speed AND p.ram=q.ram AND p.model!=q.model
ORDER BY p.model;
Hi,
I've a table named PC as below: PC(code, model, speed, ram, hd, cd, price) I want to write a query to find the pairs of PC models having similar speeds and RAM. Also, in the result set, the pairs of PC's being compared should occur only once, i.e, if (i,j) is compared then (j,i) shouldn't be compared. Plz help me solve this query.
Thanks,
Babu
-
SELECT DISTINCT T1.model,,T2.model, T1.speed, T1.ram
-
FROM pc T1, pc T2
-
WHERE T1.speed=T2.speed AND T1.ram=T2.ram AND T1.model<>T2.model
-
ORDER BY T1.model;
-
since in this case we use 2 alias for the same table and join both the tables this is the example of SELF JOIN (join of a table with itself)
Hope that helps u
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Erich Trowbridge |
last post by:
Has anybody seen this tool? It is awesome. check out
http://vw.vermeer.org/ . It's a php front end for large-scale syslog
deployments. It makes managing syslog in large networks a snap.
The idea...
|
by: Ralph Freshour |
last post by:
I'm not sure the follow multiple table query is the right way to do
what I need to do although it seems to be working:
$php_SQL = "SELECT * ".
"FROM basics, personal, photos ".
"WHERE...
|
by: Surendra |
last post by:
I have this query that I need to use in an Update statement to
populate a field in the table by the value of Sq
----------------------------------------------------------------------------
Inline...
|
by: netpurpose |
last post by:
I need to extract data from this table to find the lowest prices of
each product as of today. The product will be listed/grouped by the
name only, discarding the product code - I use...
|
by: stu_gots |
last post by:
I have been losing sleep over this puzzle, and I'm convinced my train
of thought is heading in the wrong direction. It is difficult to
explain my circumstances, so I will present an identical...
|
by: paii |
last post by:
I have a table that stores job milestone dates. The 2 milestones I am
interested in are "Ship Date" TypeID 1 and "Revised Ship Date" TypeID 18.
All jobs have TypeID 1 only some jobs have TypeID 18....
|
by: Alicia |
last post by:
Hello everyone based on the data, I created a union query which
produces this.
SELECT ,,, 0 As ClosedCount
FROM
UNION SELECT
,, 0 AS OpenedCount,
FROM
ORDER BY , ;
|
by: Aaron |
last post by:
Complete code follows.
I am new to .NET programming (and programming in general) and I am having a
difficult time understanding how to fill a variable in one sub, and then
access it from...
|
by: Takeadoe |
last post by:
Dear NG,
Can someone assist me with writing the little code that is needed to
run an update table query each time the database is opened? From what
I've been able to glean from this group, the...
|
by: Chuck36963 |
last post by:
Hi all,
I've been working on a listing problem and I can't figure out how to work it out. I have looked far and wide on the web to find answers, but I'd like other peoples input on my project in...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
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...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
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)...
|
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...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
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...
| |