Questions tagged [rows]

A row is a single data item in a database, spreadsheet, table, grid or list. When using this tag, please also add additional tags to clarify your specific environment/language/use case.

A row is a single data item. In the context of a database or similar data structure, it's also known as a or and will have a well-defined structure. In the context of a dataset in data science, each row represents an observation.

Rows can also be added to a less structured data source, such as a , , grid or .

4419 questions
8
votes
3 answers

How do I SUM DISTINCT Rows?

I'm struggling with a query where I need to SUM DISTINCT Rows. There has to be a way to do this... but I'm lost. Here's what I've got: SELECT DISTINCT Zipcodes.CountyID, us_co_est2005_allData.PopEstimate2005,…
Russell Schutte
  • 237
  • 2
  • 4
  • 12
8
votes
3 answers

Replace rows with 0s in dataframe with preceding row values diverse than 0

Here an example of my dataframe: df = read.table(text = 'a b 120 5 120 5 120 5 119 0 118 0 88 3 88 3 87 0 10 3 10 3 10 3 7 4 6 0 5 0 4 0', header = TRUE) I need to replace the 0s within col b with each preceding number diverse than 0. Here my…
aaaaa
  • 149
  • 2
  • 18
  • 44
8
votes
8 answers

Oracle SQL returns rows in arbitrary fashion when no "order by" clause is used

Maybe someone can explain this to me, but when querying a data table from Oracle, where multiple records exist for a key (say a customer ID), the record that appears first for that customer can vary if there is no implicit "order by" statement…
jgunnink
  • 171
  • 1
  • 2
  • 5
8
votes
1 answer

Mysql "select * from" doesn't return all rows

I'm used to PostgreSQL and don't understand this behaviour on MySQL. This table (from SugarCRM) has 3057 rows: mysql> SELECT count(*) FROM tasks ; +----------+ | count(*) | +----------+ | 3057 | +----------+ But when running SELECT * FROM…
8
votes
1 answer

Hide row with specific cell value DataGridView C#

I'm having trouble hiding rows with 0 value in DataGridView. foreach (DataGridViewRow row in this.taggGrid.Rows) { if (Convert.ToString(row.Cells[4].Value).Equals(0)) { row.Visible = false; } } The row I want to hide still…
XenoPsy
  • 93
  • 1
  • 1
  • 6
8
votes
3 answers

R data - Changing my data frame (converting columns into rows and vice versa)

So I have created a data frame in R with this output called 'data' But I want to convert my data frame to something like the one below How would I go about doing this?
Gladdys Gotherin
  • 167
  • 1
  • 3
  • 7
8
votes
4 answers

select all rows except top row

how do I return all rows from a table except the first row. Here is my sql statement: Select Top(@TopWhat) * from tbl_SongsPlayed where Station = @Station order by DateTimePlayed DESC How do I alter my SQL statement to return all rows except…
D-Dawgg
  • 117
  • 1
  • 2
  • 9
7
votes
3 answers

How to find Column with same (some x value) value repeated more than once? Needs to return those rows.

There is a table called contacts with columns id, name, address, ph_no etc. I need to find out rows with the same name, if the rows count is more than 1, show those rows. For example: Table:…
Chandra Sekhar
  • 16,256
  • 10
  • 67
  • 90
7
votes
6 answers

swap rows in datagridview in c#

i have a datagridview which is not related with dataTable. and i want to swap for example 1st and 10th rows in datagridview. i use this code for it int row_1 = 1; int row_10 = 10; for(int i=0;i
namco
  • 6,208
  • 20
  • 59
  • 83
7
votes
1 answer

correlation by row, within data frame

I am attempting to calculate the correlation between all the rows of a large data frame, and so far have come up with a simple for-loop that works. For example: name <- c("a", "b", "c", "d") col1 <- c(43.78, 43.84, 37.92, 31.72) col2 <- c(43.80,…
fragf
  • 81
  • 1
  • 3
7
votes
1 answer

How do I divide the rows of a matrix by different values in MATLAB (array division)

Lets said I have the matrix M = ones(3); and I want to divide each row by a different number, e.g., C = [1;2;3];. 1 1 1 -divide_by-> 1 1 1 1 1 1 1 -divide_by-> 2 = 0.5 0.5 0.5 1 1 1 -divide_by-> 3 0.3 0.3 0.3 How can I do this…
adn
  • 897
  • 3
  • 22
  • 49
7
votes
3 answers

counting rows before processing with a cursor tsql

I have a SQL Server sp using a cursor thus: DECLARE TestCursor CURSOR FOR SELECT tblHSOutcomes.strOutcomeName, tblHSData.fkHSTest FROM tblHSData INNER JOIN tblHSOutcomes ON tblHSData.fkOutcome =…
nat
  • 2,185
  • 5
  • 32
  • 64
7
votes
4 answers

Return unlocked rows in a "select top n" query

I need to have a MsSql database table and another 8 (identical) processes accessing the same table in parallel - making a select top n, processing those n rows, and updating a column of those rows. The problem is that I need to select and process…
Diana
  • 249
  • 1
  • 5
  • 12
7
votes
2 answers

MySQL - How to count rows before pagination?

I am making a search page to find users. I have que query to find them and actually I can do the pagination with "LIMIT startRow, numberRows". But how could I count the total number of "registers" found before doing the pagination? I would like to…
wilmerlpr
  • 448
  • 6
  • 15
7
votes
1 answer

Counting number of instances of a condition per row R

I have a large file with the first column being IDs, and the remaining 1304 columns being genotypes like below. rsID sample1 sample2 sample3...sample1304 abcd aa bb nc nc efgh nc nc nc nc…
nchimato
  • 443
  • 4
  • 8
  • 18