Solved

This is an interbase question!

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Path  to current project in Delphi. 2 79
Intraweb download file link ? 1 133
JAudiorecorder record freezing the app 29 67
RESTRequest Parameter 4 30
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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