rows

DELETE FROM statement not working

血红的双手。 提交于 2020-01-07 07:59:38
问题 I have a table in a database called 'threads' and I want to delete a row where the id is equal to $forumid which is set by the URL. The URL looks something like this: domain.com/viewThread.php?forumid=1 I am getting this using $forumid = $_GET['forumid']; and I am sure that this is working because I use echo $forumid; and it works correctly. But when I go to delete a row using $db->query("DELETE FROM threads WHERE id='$forumid'"); its not working for some reason. Can somebody please help me

Join rows from two different queries

痴心易碎 提交于 2020-01-07 03:12:13
问题 I have a table sales_table with a id,date and sales fields. no date sales ---------------------------------------------------- 1 1-Jan 10,000 2 3-Jan 12,500 3 4-Jan 8,000 4 5-Jan 12,000 5 8-Jan 10,000 " " " " " " " " " " " " " " " " " " " " " " " " " " " 100 13-Mar 4000 the date is unique but not always in series. the no is unique and in series with a incremented no of each higher date. I am looking to get the difference between the sales of the current and previous date. something like no

How to consolidate duplicates in Excel where several columns need to remain uncosolidated

*爱你&永不变心* 提交于 2020-01-07 02:38:26
问题 I am trying to do a stock count through product stores but have several part numbers that are listed twice (Column A). When I try to consolidate these I recieve the error 'no data consolidated' which I think is caused by Columns B-F (which will always be the same if Column A value is the same). I want to consolidate the rows where columns A-F are the same, into a singular row with Column G representing the subtotal of Column F for all duplicate rows. Screenshot of Corresponding Spreadsheet I

R: How to combine duplicated rows from multiple columns based on unique values in a single column and merge those unique values by |?

安稳与你 提交于 2020-01-06 04:31:51
问题 I have the following data frame: gene gene_name source chromosome details 1 a A 2 01; xyz 1 a A 2 02; ijk 2 b B 3 03; efg 2 b C 3 03; efg 3 c D 4 04; lmn 3 c D 4 05; opq 3 c D 4 06; rst 4 NA 10 6 NA 4 NA 11 6 NA I want to get the following output: gene gene_name source chromosome details 1 a A 2 01; xyz | 02;ijk 2 b B, C 3 03; efg 3 c D 4 04; lmn | 05; opq | 06; rst 4 NA 10, 11 6 NA | NA I have tried to use aggregate() and group_by() in different ways, but did not get it. Please guide. Thanks

Hadoop-> Mapper->How can we read only Top N rows from each file from given input path?

两盒软妹~` 提交于 2020-01-06 03:18:08
问题 I am new to Hadoop, My requirement is I need to process only first 10 rows from the each input file. and how to exit mapper after reading 10 rows of each file. If anyone can provide some sample code , it would be great help. thanks in advance. 回答1: You can override the run method of your mapper, and once you've iterated the map loop 10 times you can break from the while loop. This will assume your files are not splitable, otherwise you'll get the first 10 lines from each split: @Override

How to identify “similar” rows in R?

≡放荡痞女 提交于 2020-01-06 02:05:07
问题 Hi to all the members of the community, I am trying to find out how to compare elements of my DB and identify them by a new binary variable. My DB is like this: id=rep((1:2),5) date<-seq(from=as.Date("2013-01-1"),to=as.Date("2013-01-05"),by=1) trap<-c(1,1,3,1,4,2,3,4,1,4) DB<-data.frame(id,date,trap) DB<-DB[order(DB$date),] DB$id[2]<-1 DB$trap[2]<-1 result<-c("N","N","N","N","N","N","Y","Y","Y","Y") DB<-cbind(DB,result) and I want to identify all the elements for which the id is different,

How to add arbitrary rows of zeroes in matrices/excel spreadsheet? (Matlab) [duplicate]

一个人想着一个人 提交于 2020-01-05 07:27:26
问题 This question already has an answer here : How to add rows of zeroes in matrices/excel spreadsheet with code (MATLAB)? (1 answer) Closed 4 years ago . I have a XLS file with 3 columns and 212 rows of data. Is there any way to insert 3 columns of zeroes with x number of rows in the middle, so there is a total of 365 rows? 回答1: Another way you can do this is via the excel activex control. The following assume you have an excel spread c:\temp\zeros.xlsx. It inserts 5 rows each with 3 columns of

Replace a value in a dataframe with the row name

对着背影说爱祢 提交于 2020-01-04 13:04:52
问题 I have a data frame that looks like this: Jill Jimmie Alex Jane Jill 1 0 1 1 Jimmie 0 1 1 0 Alex 0 1 1 0 Jane 1 1 1 0 I want to change every 1 to its corresponding row name, such as this: Jill Jimmie Alex Jane Jill Jill 0 Jill Jill Jimmie 0 Jimmie Jimmie 0 Alex 0 Alex Alex 0 Jane Jane Jane Jane 0 After that, I want to remove all zeros from the data frame and move up the values in the columns. I've tried: # for (i in ibm_data){ # if (ibm_data == 1){ # names <- row.names(i) # ibm_data[ibm_data

Mysql EAV match row as field or entity's property value

元气小坏坏 提交于 2020-01-04 10:59:17
问题 My Mysql database has objects which are defined by an object type which is then joined to set it's properties. And it is based on the Entity Attribute Value model as pointed out by Spencer. The database is a little more complicated then below but this should make my question a little more clear. I have a mysql table objects which contains some basic information about an object say create_date , title , author and of course an id . I also have a table object_properties which contains some more

correlation by row, within data frame

我与影子孤独终老i 提交于 2020-01-04 05:30:07
问题 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, 43.40, 37.64, 31.62) col3 <- c(43.14, 42.85, 37.54, 31.74) df <- data.frame(name, col1, col2, col3) cor.df <- data.frame(name1=NA, name2=NA,correl=NA) for(i in 1: (nrow(df) - 1)) { for(j in (i+1): nrow(df) ) { v1 <- as.numeric( df[i, 2:ncol(df)] ) v2