|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
assist'ce with 'ORDER BY' clause
how can I list the various PERFORMERS which have the same CONCERTDATE AND CONCERTVENUE. So pretty much PERFORMERS performing at the same location on the same day.
SQL> desc futureconcerts; Name Null? Type ----------------------------------------- -------- ------------- CONCERTID NOT NULL NUMBER CONCERTVENUE VARCHAR2(20) CONCERTDATE DATE PERFORMERS VARCHAR2(3) |
|
#2
|
|||
|
|||
|
select concertdate, concertvenue, performers
from futureconcerts order by 1,2; This is so damn easy that I'm sure I missed something in your question... |
|
#3
|
|||
|
|||
|
That what I did too but is not correct. Lemme see if i can explain it better.
I need to pull out performers who are going to perform at the same venue on any particular/given date. so date and venue's in common of performers...and to only list exactly that. Table data: CONCERTVENUE CONCERTDATE PERFID -------------------- --------------- ------- va2 23/NOV/03 p25 va21 22/NOV/03 p25 va21 22/NOV/03 p27 va21 22/NOV/03 p26 va22 22/NOV/03 p10 va24 24/NOV/03 p25 va29 25/NOV/03 p25 va30 28/NOV/03 p35 va30 28/NOV/03 p35 va30 28/NOV/03 p45 va30 28/NOV/03 p46 ------------------------------------------------------------------- Desired Outcome: va21 22/NOV/03 p25 va21 22/NOV/03 p27 va21 22/NOV/03 p26 va30 28/NOV/03 p35 va30 28/NOV/03 p35 va30 28/NOV/03 p45 va30 28/NOV/03 p46 Last edited by ratumeli : November 21st, 2003 at 05:49 PM. |
|
#4
|
|||
|
|||
|
My guess is:
SELECT CONCERTVENUE, CONCERTDATE, PERFORMERS FROM FUTURECONCERTS, (select CONCERTVENUE,count(*) from FUTURECONCERTS group by CONCERTVENUE having count(*)>1) a WHERE CONCERTVENUE = a.CONCERTVENUE / |
|
#5
|
|||
|
|||
|
Thanks for the effort Shafique but no go =(
|
|
#6
|
|||
|
|||
|
I knew I missed something in the original post.
Nice solution shafique! ![]() @ratumeli: works for me, although I had to supply a table alias for the futureconcerts table in the FROM clause and qualify the columns in the select list (but I tested it with Postgres, not Oracle, but that shouldn't matter) Code:
SELECT f1.concertvenue,
f1.concertdate,
f1.performers
FROM futureconcerts f1,
(SELECT concertvenue,
COUNT(*)
FROM futureconcerts
GROUP BY concertvenue
HAVING COUNT (*) > 1
) a
WHERE f1.concertvenue = a.concertvenue
order by 2
|
|
#7
|
|||
|
|||
|
All I'd like to say Shammat is BULLSEYE !
Gave me exactly what I required. Thanks for your time and effort Shammat and you too Shafique, i tried to mod your code to my liking but I must have wondered off somewhere. |
|
#8
|
|||
|
|||
|
The credit goes to shafique. It's basically the same statement!
|
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > assist'ce with 'ORDER BY' clause |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|