By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,671 Members | 1,278 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,671 IT Pros & Developers. It's quick & easy.

What this query return ERROR?? :(

P: n/a
SELECT railways.id
FROM railways
WHERE Min(id)=10
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Think about what you are telling it to do:

Select the ID from Railways where the minimum ID is 10. Minimum ID out
of which IDs? Either group records to have several IDs to choose from or
remove Min.

Pavel

Yura Zavaliy wrote:

SELECT railways.id
FROM railways
WHERE Min(id)=10

Nov 12 '05 #2

P: n/a
bt*@ck.ukrtel.net (Yura Zavaliy) wrote in message news:<29**************************@posting.google. com>...
SELECT railways.id
FROM railways
WHERE Min(id)=10

Min requires a GROUP BY clause... try

SELECT railways.ID
From railways
WHERE ID<=10;
Nov 12 '05 #3

P: n/a
You probably want all the ids that are greater than 10?

If so, try

SELECT id
FROM railways
WHERE id >= 10

MIN is a function that requires you to GROUP your records (like SUM or AVG
or COUNT). For example, if you wanted to count how many records existed for
each "id", then:

SELECT id, COUNT(*) AS COUNTER
FROM railways
GROUP BY id
ORDER BY id

hope this is helpful,

cheers,
Matt.

"Yura Zavaliy" <bt*@ck.ukrtel.net> wrote in message
news:29**************************@posting.google.c om...
SELECT railways.id
FROM railways
WHERE Min(id)=10

Nov 12 '05 #4

P: n/a
Dear Yura:

Do you perhaps mean:

SELECT railways.id
FROM railways
WHERE id >= 10

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts

On 17 Dec 2003 07:21:43 -0800, bt*@ck.ukrtel.net (Yura Zavaliy) wrote:
SELECT railways.id
FROM railways
WHERE Min(id)=10


Nov 12 '05 #5

P: n/a
Pavel Romashkin <pa*************@hotmail.com> wrote in message news:<3F**************@hotmail.com>...
Think about what you are telling it to do:

Select the ID from Railways where the minimum ID is 10. Minimum ID out
of which IDs? Either group records to have several IDs to choose from or
remove Min.

Pavel

Yura Zavaliy wrote:

SELECT railways.id
FROM railways
WHERE Min(id)=10

Sorry, full query:
SELECT *
FROM railways
WHERE id in (select id from railways where
min(Capital_Subscribed)*10<=max(Capital_Subscribed ) group by id)

My goal - take result records, which min and max value of
"Capital_Subscribed" differ times more... Sorry my bad english :(
Nov 12 '05 #6

P: n/a
Dear Yura:

I replied to your private email, but your "account is full (quota
exceeded)" and it bounced back to me. Below is my repsonse:

Does this subquery work:

select id
from railways
where min(Capital_Subscribed) * 10 <= max(Capital_Subscribed)
group by id

That is, of course, the query you're using to provide a set of id
values for the in() clause you've constructed.

Tom

On Wed, 17 Dec 2003 13:55:23 -0600, Tom Ellison <te******@jcdoyle.com>
wrote:
Dear Yura:

Do you perhaps mean:

SELECT railways.id
FROM railways
WHERE id >= 10

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts

On 17 Dec 2003 07:21:43 -0800, bt*@ck.ukrtel.net (Yura Zavaliy) wrote:
SELECT railways.id
FROM railways
WHERE Min(id)=10


Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.