Solved

This is an interbase question!

Posted on 2001-08-30
2
325 Views
Last Modified: 2008-03-10
I run the following query in interbase 5.5:

select h.socialsecuritynumber,h.lastname,
h.firstname,s.underggradcollege,h.homecity,h.homestatecode,
(select min(termid) from coursetaker where studentid=h.humanid) startterm
from coursetaker c,human h,student s
where
c.studentid=h.humanid
and
h.humanid=s.belongstohumanid
and
c.termid between 10009 and 10106
order by h.lastname,h.firstname

It works ok, but one thing. I want non-duplicate records. I put distinct after select and before all the fields and it gives an error:

General SQL error.
Invalid request BLR at offset 215
context already in use (BLR error).

Does anybody know how can I run the above query for distinct records?
Thank you.
0
Comment
Question by:sigalos
2 Comments
 

Accepted Solution

by:
AndreDicks earned 75 total points
ID: 6444122
I think that if you use 'group by ' for all your fields you ought to be alright.

Regards
Andre
0
 

Author Comment

by:sigalos
ID: 6445317
You are right. I did found the answer already by using group by and distinct at the same time.
Then, I wanted to do something more:

select h.socialsecuritynumber,h.lastname,
h.firstname,s.underggradcollege,h.homecity,h.homestatecode,
(select termcode from term where termid in
(select min(termid) from coursetaker where studentid=h.humanid)) startterm
from coursetaker c,human h,student s
where
c.studentid=h.humanid
and
h.humanid=s.belongstohumanid
and
c.termid between 10009 and 10106
order by h.lastname,h.firstname

and this one runs forever.

You have the points, but I was just wondering if you have a suggestion there too. You have been of great help...

Thank you.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

839 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