If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > group by query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-08-03, 20:05
mojojo82 mojojo82 is offline
Registered User
 
Join Date: Jul 2003
Posts: 21
group by query

Hi I'm trying to execute the following query:

select screen_name, amount from acnt_plyr plyr,
(select sum(amount) as amount, time_stamp from acnt_tran
where type in (8,10) and time_stamp < to_date('2003-06-20 23:59:59', 'YYYY-MM-DD HH24:MIS')
and time_stamp > to_date('2003-05-20 00:00:00', 'YYYY-MM-DD HH24:MIS')
group by time_stamp order by amount desc) t1,
acnt_acnt acnt
where t1.acnt_id = acnt.id and plyr.id = acnt.plyr_id and acnt.IS_REAL=1
and screen_name in ('Z350')

but it complains on the 2nd last line that it doesn't know what t1 is (Invalid identifier)

Anyone have any ideas? thanks

Last edited by mojojo82; 07-08-03 at 20:12.
Reply With Quote
  #2 (permalink)  
Old 07-09-03, 03:01
andrewsc andrewsc is offline
Registered User
 
Join Date: Jun 2003
Location: Sydney, Australia
Posts: 65
Re: group by query

the subquery should return a column named "acnt_id" in its Select list. The Invalid Identifier error does not refer to T1. It refers to "acnt_id", and I can see that it is indeed missing.
Reply With Quote
  #3 (permalink)  
Old 07-09-03, 15:10
mojojo82 mojojo82 is offline
Registered User
 
Join Date: Jul 2003
Posts: 21
thanks a lot !!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On