Whenever I am running a query in which FIRST function of access is used, qury just hangs up and does not produce any result. could any one guide on this?
I am using MS Access 2000 and OS is windows server 2003 and SQL 8.0
5 1184
Hi
You will need to post the details of your query. Open it in Design View, then click View, then SQL View
Then copy and paste the test to the forum
An idication of whet you are truing to achieve might also be useful
S7
NeoPa 32,556
Expert Mod 16PB
Another point to consider :
Dou you really want First(), or would maybe the DISTINCTROW predicate of the SELECT clause suit you better?
This is the query I am trying to run - SELECT [CLIR] AS zCLIR, First([LIR]) AS zLIR, First([Prefix]) AS zPRE, First([FirstName]) AS zFN, First([MI]) AS zMI, First([LastName]) AS zLN, First([StandardTitle]) AS zTL FROM [sql_DDMContact] GROUP BY CLIR HAVING CLIR >= 0
This query always hangs but when I remove the first() function it works out.
Please guide on this. this table sql_DDMContact is a link table in mdb
This is the query I am trying to run - SELECT [CLIR] AS zCLIR, First([LIR]) AS zLIR, First([Prefix]) AS zPRE, First([FirstName]) AS zFN, First([MI]) AS zMI, First([LastName]) AS zLN, First([StandardTitle]) AS zTL FROM [sql_DDMContact] GROUP BY CLIR HAVING CLIR >= 0
This query always hangs but when I remove the first() function it works out.
Please guide on this. this table sql_DDMContact is a link table in mdb
Does the CLIR value occur multiple times, assigned to different people and you are trying to get the 1st person it was assigned to?
Otherwise: - SELECT [CLIR] AS zCLIR, [LIR] AS zLIR, [Prefix] AS zPRE, [FirstName] AS zFN, [MI] AS zMI, [LastName] AS zLN, [StandardTitle] AS zTL
-
FROM [sql_DDMContact]
-
WHERE CLIR >= 0
-
GROUP BY CLIR, LIR, Prefix, FirstName, MI, LastName, StandardTitle
If it is a very large dataset in your linked tables and you are using First, Last, Min, Max type values you may want to go to the properties of the query and set TimeOut to 0. This will prevent the 60 sec timeout.
NeoPa 32,556
Expert Mod 16PB
Firstly, a reminder to everyone to use [ CODE ] tags where possible. This is a requirement of the site and it is there for very good reasons.
Moving on :)
I would only make a minor amendment to your SQL which is to use WHERE instead of HAVING. This may make little difference as the optimiser should catch it for you. The DISTINCT predicate won't help you as there is no (discernable) Primary Index. - SELECT [CLIR] AS zCLIR,
-
First([LIR]) AS zLIR,
-
First([Prefix]) AS zPRE,
-
First([FirstName]) AS zFN,
-
First([MI]) AS zMI,
-
First([LastName]) AS zLN,
-
First([StandardTitle]) AS zTL
-
FROM [sql_DDMContact]
-
WHERE CLIR >= 0
-
GROUP BY CLIR
As Jax has said though, change the default timeout value. 0 is fine or I often use 300. That is 5 minutes and in most cases that should return some results or something is wrong. Another setting I'd change would be the Recordset Type from Dynaset to Snapshot.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Wescotte |
last post by:
Here is a small sample program I wrote in PHP (running off Apache
1.3.31 w/ PHP 5.0.1) to help illustrates problem I'm having. The data
base is using DB2 V5R3M0. The client is WinXP machine using...
|
by: Aaron Whiffin |
last post by:
Hi, I've set up the following table in MySQL 3.23.58 and all seemed to be
working fine:
CREATE TABLE advert (
id INT NOT NULL AUTO_INCREMENT,
userid INT NOT NULL,
make VARCHAR(25) NOT NULL,...
|
by: Joshua Belden |
last post by:
Okay, how I get myself into these situations, I don't know, but I have to
design a component to plug into a C# Windows Forms application that allows
the user to design a sql query. I'm thinking of...
|
by: manny |
last post by:
I wish I knew what this was called, and I could have made a more sensible
subject. For that matter, I knew what it was called, I could have googled it!
Anyway, let's I have a table with name,...
|
by: Frankie |
last post by:
I'm trying to run the following search query:
$query =
sprintf ("SELECT itemNumber, thumbnailURL, title, description, price
FROM apparel,hats
WHERE apparel.title OR apparel.description OR...
|
by: Simon Rigby |
last post by:
Hi folks,
ASP.NET2, Sql Server 2005
I have an app that executed a sql server query that produces an XML
file used as the DateFile for an XMLDataSource bound to a TreeView. The
bizarre thing...
|
by: josh2007 |
last post by:
hi all,
I'm having a hard time producing the correct sql statement for my tables.
below is my sql statement but i'm getting incorrect result. This particular query returns the sum of all the...
|
by: lenygold via DBMonster.com |
last post by:
Hi everybody!
This query is supposed to count consecutive years from the current year
without OLAP.
Input Table:
ID DateCol
1 02/01/2006
1 01/01/2006
1 01/01/2005
|
by: Lensmeister |
last post by:
Hi,
As a newbie here I hope someone cane help me.
I have Acess 2003 and am making a database that holds records or football matches. I haven't created any relationships as yet. The main table...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |