What this query return ERROR?? :(

  • Thread starter Thread starter Yura Zavaliy
  • Start date Start date
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
 
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.
 
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
 
Pavel Romashkin said:
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


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 :(
 
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



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

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