Solved

how to do this qustion in sql (2)

Posted on 1998-12-10
2
174 Views
Last Modified: 2010-03-19
hi, here is another question. I am learning sql now so I have many unclear question.
say like this table:
name ticket
chris 01
chris 02
chris 03
kim 04
kim 03
Gal 03
Gal 04
Gal 05

find the person who has every ticket that Kim has.
in this case it will be: Gal
0
Comment
Question by:ny971181
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
cognition earned 50 total points
ID: 1092215
SELECT t1.name
FROM tickets t1, tickets t2
WHERE t1.ticket = t2.ticket
AND t2.name = "Kim"
AND t1.name <> "Kim"
GROUP BY t1.name
HAVING COUNT(*) >= (SELECT COUNT(*) FROM tickets WHERE name = "Kim")


0
 
LVL 1

Author Comment

by:ny971181
ID: 1092216
PERFECT, SEE I LEARNED HOW TO USE SELF JOIN!!
THANK YOU!
MAY BE YOU KNOW HOW TO DO THE OTHER ONE TOO
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question