|
I have an oracle database populated with million records. I am trying to write a SQL query that returns the first 'N" sorted records ( say 100 records) from the database based on certain condition.
SELECT * FROM myTable Where SIZE > 2000 ORDER BY NAME...
Started by aJ on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
If you want to pick 100 random rows, sort those, and then return them, you'll have to formulate a query without the ORDER BY first, then limit that to 100 ... .
However, this won't do what you're asking.
Add this:
AND rownum <= 100
to your WHERE-clause.
|
|
I have two tables in an MS SQL Server 2005 database, parent and child, where the parent may be related to many child records. [Child.parent_id] is related to [parent.id]. The child table also has column [foo] I need to bring back all records in the parent...
Started by The Talking Walnut on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
records which have [at least] one child with a 'fizz' foo AND [at least] one child with 'buzz' foo.
|
|
Hi all,
i have a sql server table with records (that isn't new) it has 1 or more records (measurements) for a person, and all records have a datetime field. So for person 1 i have 5 records / measurements, dated jan 1, jan 2, feb 8, march 19 and july ...
Started by Michel on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
From p in Context.WhateverYourTableNameIs group p by p.PersonId into g select new { PersonId = g.Key MostRecentMeasurementDate... .
Table columnd names, table name...
For example a scema or table structure.
This can be done, but we may need more information to help you out .
|
Ask your Facebook Friends
|
I've bought a CSV United States business database with ~20 million records, which is divided to 51 databases, every database represents a state.
I need to write an ASP.NET MVC Web Application that will query this database, by state and more arguments....
Started by Alon on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
A database is designed....
But, do it in a structured, and you should be fine .
Create a single database, where you put all those records in.
I would import the data things up.
20 million records is peanuts.
One table, with appropriate indexes.
|
|
I have an ms-access table
TableA MSN PR 11 - 13 A 12 Dead 14 B 15 C
How can i write an sql query to remove records in "-" and "Dead" occurances in PR collumn. so that query result should be
MSN PR 13 A 14 B 15 C
any help appreciated
Started by silverkid on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
To exclude the rows from a selection:
select * from TableA where PR not in ('-','Dead')
Or to permanently remove them:
delete from TableA where PR not in ('-','Dead')
select msn, pr from tableA where pr not in ('_', 'Dead')
The answer essentially is... .
|
|
I'm loading a CSV file containing many thousands of rows into a .NET DataTable that looks something like this:
MyLocalDataTable SequenceNo, Etc
I have a table in an SQL database and I'd like to pull records into another datatable based on what I find ...
Started by Brett on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Then, you execute ....
If you're using SQL Server, you can do this using bulk insert, which is very fast .
Dump the sequence number values into a staging table, a "temporary" table that contains only one column, of the right type to hold a sequence number .
|
|
Function mycart($mydate=null,$day=null) { $mycart= $this->session->userdata('mycart'); $totalprice=$this->session->userdata('totalprice'); if($this->limitation($mydate) && (!(isset($mycart[$mydate]))) ) { $mycart[$mydate] = array( 'meal...
Started by nupura on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You need to use a multidimensional array in this case, i.e.:
$mycart[$mydate][] = array( 'meal' =>$this->session... .
If you have two carts with the same $mydate value, the latter will override the first value .
Perhaps your issue is with your array itself.
|
|
In a scenario where I have a table like so:
int id (PK) int staff_id int skill_id bit mainskill
I want to select only ONE record for each staff member (represented by staff_id) listing their main skill as represented by a (1) in mainskill. If no main ...
Answer Snippets (Read the full thread at stackoverflow):
SQL Server 2005+, Using CTE: WITH rows AS ( SELECT t.id, t.staff_id, t.skill_id, t.mainskill, ROW_NUMBER() OVER (PARTITION BY t.staff_id ORDER BY t.mainskill DESC) AS rank FROM TABLE t) SELECT r.id, r.staff_id, r.skill_id, r.mainskill FROM rows r WHERE... .
|
|
Hi guys I need help here again - I have two tables here both contain like lots of records in the tens of thousands. Now we have one main table whose schema is like this:
ID | Location Name | Label | Description | Longitude | Latitude
And we have another...
Started by Ali on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
With MySQL 4.0+ you should be able to use the INNER JOIN syntax below:
UPDATE new_table INNER JOIN old_table ON (old_table.id = new_table.id) SET new_table.latitude = old_table.latitude, new_table.longitude = old_table.longitude;
Otherwise, you should... .
|
|
Is the anyway to run nslookup (Centos 5 or windows) such that it will look up record types other than A, without having to go to interactive mode and using "set type="? For example, I'd like a command like the following:
nslookup --type=SRV _ldap._tcp...
Started by DrStalker on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at serverfault):
Nslookup doesn't have a powerful non-interactive mode:
"Non-interactive mode is used to print just the name and requested information for a host or domain"
Instead, use host(1):
host -t SRV example... .
It appears the nslookup man page isn't correct anymore.
|