Solved

This is an interbase question!

Posted on 2001-08-30
2
326 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…

733 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