compare

Oracle Replace function

℡╲_俬逩灬. 提交于 2019-12-02 03:19:20
I need to replace the Table1's filed values from Table2's values while select query. Eg: Table1: Org Permission -------------------------------------- Company1 1,3,7 Company2 1,3,8 Table2: Permission Permission -------------------------------------- 1 Read 3 Write 7 Execute 8 Delete I need like this: Org Permission -------------------------------------- Company1 Read,Write,Execute Company2 Read,Write,Delete If you don't want to update the existing table and only want to select the data then you can use this somewhat laborious query. http://sqlfiddle.com/#!4/22909/4 WITH changed_table AS

How to compare arrays? And change attributes?

折月煮酒 提交于 2019-12-02 02:54:05
问题 I'm new ios developer, I want to compare and change attributes Array1 = (object1,object2, object3, object4) Array2 = (object2,object4, object5, object8) Compare Array1 and Array2 If same objects are in Array2, change attributes in the objects. In this case above, Object2 and Object4 should be changed.. How should I do?? Please help me!! 回答1: You can use sets for this NSMutableSet *array1Set = [NSMutableSet setWithArray:array1]; NSSet *array2Set = [NSSet setWithArray:array2]; [array1Set

How to compare a longtext and date value in sql?

好久不见. 提交于 2019-12-02 02:50:20
I have date value stored in format dd.mm.yyyy as longtext . I need to compare this value to CURDATE() within a SELECT statement. (Please, don't ask me why it is saved in longtext.) Is there any way to do it? This piece of code is not working of course, but it illustrates what I want to do: ... WHERE longtext_date_value <= CURDATE() ... As Sergey comments: if MySQL, you can simply use STR_TO_DATE : ... WHERE STR_TO_DATE(longtext_date_value,'%d.%m.%Y') <= CURDATE() ... 来源: https://stackoverflow.com/questions/9351476/how-to-compare-a-longtext-and-date-value-in-sql

Compare values in csv files

孤街浪徒 提交于 2019-12-02 02:47:27
I am comparing different values in two csv files. If I do not have a match, I want to add (or update) my devices in my Management System. output1.csv (name, ip) - Primary system Test1, 10.56.7.13 Test2, 10.56.4.14 Test3, 10.56.5.15 output2.csv (id,name,ip) - Secondary system 1234,Test1, 10.56.7.13 1235,Test2, 10.56.4.10 My result should be: I do nothing with Test1 (because it is already in System 2), I should update Test2 (because now I have a different ip address) and I should add Test3 , because I do not have it in the secondary System. use strict; use warnings; use feature qw(say); use

PHP compare dates [duplicate]

孤人 提交于 2019-12-02 02:33:26
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: php date compare I have a date that I take from the mySQL database that looks like this: 2011-06-20 And I get the date of the current day in this way: $todaydate = date('Y-m-d'); What I need to know is how do I compare the two results? How can I compare the dates and understand for example if a week is passed from the database date or a month or a year..etc..? Thank you!! 回答1: There is no need to put that burden

Behavior of identical() in apply in R

。_饼干妹妹 提交于 2019-12-02 02:27:58
问题 This is weird. apply( matrix(c(1,NA,2,3,NA,NA,2,4),ncol = 2), 1, function(x) identical(x[1], x[2]) ) #[1] FALSE TRUE TRUE FALSE apply( data.frame(a = c(1,NA,2,3),b = c(NA,NA,2,4)), 1, function(x) identical(x[1], x[2]) ) #[1] FALSE FALSE FALSE FALSE apply( as.matrix(data.frame(a = c(1,NA,2,3),b = c(NA,NA,2,4))), 1, function(x) identical(x[1], x[2]) ) #[1] FALSE FALSE FALSE FALSE This is due to the names attribute as indicated below by joran. I can obtain the result I expected by: apply( data

Behavior of identical() in apply in R

亡梦爱人 提交于 2019-12-02 02:22:13
This is weird. apply( matrix(c(1,NA,2,3,NA,NA,2,4),ncol = 2), 1, function(x) identical(x[1], x[2]) ) #[1] FALSE TRUE TRUE FALSE apply( data.frame(a = c(1,NA,2,3),b = c(NA,NA,2,4)), 1, function(x) identical(x[1], x[2]) ) #[1] FALSE FALSE FALSE FALSE apply( as.matrix(data.frame(a = c(1,NA,2,3),b = c(NA,NA,2,4))), 1, function(x) identical(x[1], x[2]) ) #[1] FALSE FALSE FALSE FALSE This is due to the names attribute as indicated below by joran. I can obtain the result I expected by: apply( data.frame(a = c(1,NA,2,3),b = c(NA,NA,2,4)), 1, function(x) identical(unname(x[1]), unname(x[2])) ) or:

Multilevel JSON diff in python

99封情书 提交于 2019-12-02 01:58:42
Please link me to answer if this has already been answered, my problem is i want to get diff of multilevel json which is unordered. x=json.loads('''[{"y":2,"x":1},{"x":3,"y":4}]''') y=json.loads('''[{"x":1,"y":2},{"x":3,"y":4}]''') z=json.loads('''[{"x":3,"y":4},{"x":1,"y":2}]''') import json_tools as jt import json_delta as jd print jt.diff(y,z) print jd.diff(y,z) print y==z print x==y output is [{'prev': 2, 'value': 4, 'replace': u'/0/y'}, {'prev': 1, 'value': 3, 'replace': u'/0/x'}, {'prev': 4, 'value': 2, 'replace': u'/1/y'}, {'prev': 3, 'value': 1, 'replace': u'/1/x'}] [[[2], {u'y': 2, u

How to compare arrays? And change attributes?

梦想的初衷 提交于 2019-12-02 01:28:46
I'm new ios developer, I want to compare and change attributes Array1 = (object1,object2, object3, object4) Array2 = (object2,object4, object5, object8) Compare Array1 and Array2 If same objects are in Array2, change attributes in the objects. In this case above, Object2 and Object4 should be changed.. How should I do?? Please help me!! You can use sets for this NSMutableSet *array1Set = [NSMutableSet setWithArray:array1]; NSSet *array2Set = [NSSet setWithArray:array2]; [array1Set intersectSet:array2Set]; You now have a set with just the objects which are in both arrays. Now you can use

C: How to compare two strings? [duplicate]

▼魔方 西西 提交于 2019-12-02 00:47:18
This question already has an answer here: Why is “a” != “a” in C? 11 answers Edit: This is a duplicate and I've flagged it as such. See [question] Why is "a" != "a" in C? So I'm trying to print out a specific message depending on a field within a struct. The field contains the string "1". Whenever I run printf("%s", record.fields[2]); the output is 1 ; I've no format warnings. However, when I check the field against the corresponding string (in this case, "1"), it fails the check: if (record.fields[2] == "1") { printf("The field is 1!"); } You need to use strncmp to compare strings: if