473,387 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

What this query return ERROR?? :(

SELECT railways.id
FROM railways
WHERE Min(id)=10
Nov 12 '05 #1
6 1292
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: lawrence | last post by:
If I do something like : $result = mysql_query($query); $dbArray = dbResultIntoKeyArray($result); and this is the function: function dbResultIntoKeyArray($result) {
5
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I...
4
by: Bob Bedford | last post by:
We have no access to a mysql NG on my provider's server, so we ask here: We have a long query (long in text) with a UNION between 2 select. We have been informed that some times the query...
3
by: Dave Smithz | last post by:
Hi there, I changed one of my MySQL search queries to allow a situation where the user gets much more information returned. However, it has now given me the error message: Fatal error: Allowed...
1
by: Dot Net Daddy | last post by:
Hi, I am new to MS-SQL and I have a problem. Actually I have made similar queries on Oracle, but now I failed on MS Sql. First of all I am using SQL Server 2005, but I think it is not that much...
9
by: Frawls | last post by:
Hi I Am am having problems with a stored Procedure that i wrote. Basically whats happening is that the Stored procedure Runs fine when i EXECUTE it in SQL Query analyzer. But when i debug...
2
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
How can I run this query against a table in my Access database? I don't know hwo to use it in C#. In VB I would use .Recordset = "some sql statement". How do I do this in C#? //I get a vlaue...
13
by: Karl Groves | last post by:
I'm missing something very obvious, but it is getting late and I've stared at it too long. TIA for responses I am writing a basic function (listed at the bottom of this post) that returns...
5
by: cpweb | last post by:
<?php class fkings_DB{ //+======================================================+ function sql_connect($database){ $this->connect_id = mysql_connect ("localhost",...
4
by: =?Utf-8?B?VG9kZCBKYXNwZXJz?= | last post by:
Here is what I have: private int NationalCount() { Int32 numRecords = 0; using (SqlConnection dataConnection = new SqlConnection(GlobalVars.sqlConnString)) { SqlCommand dataCommand = new...
0
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.