logo
Tags down

shadow

Bash code for Selecting few columns from a variable


By : Nathaniel Ninffert
Date : July 31 2020, 09:00 PM
seems to work fine When you start using combinations of grep, sed, awk, cut and alike, you should realize you can do it all in a single awk command. In case of the OP, this would do exactly the same:
code :
awk '/[&]END COORD/{p=0}
     p { print $2,$3,$4 }
     /[&]COORD/{p=1}' file

UNIT angstrom
awk '/[&]END COORD/{p=0}
     p && (NF==4){ print $2,$3,$4 }
     /[&]COORD/{p=1}' file
awk '/[&]END COORD/{p=0}
     p && (NF>0) && ($1 != "UNIT"){ print $2,$3,$4 }
     /[&]COORD/{p=1}' file


Share : facebook icon twitter icon

selecting multiple rows and columns over a xml variable


By : Jonatas Miguel
Date : March 29 2020, 07:55 AM
it fixes the issue Usually I use a XML variable in filters, because they are easy to work.
code :
declare @xml xml = '<row><column1 a="a">1</column1><column2>2</column2></row><row>' +
    '<column1>3</column1><column2>4</column2></row>'

select  col.value('data(column1[1])', 'int') as column1
,       col.value('data(column2[1])', 'int') as column2
from    @xml.nodes('/row') tbl(col)

Selecting Columns From a Record Variable (PostgreSQL 8.4)


By : prinnyDev
Date : March 29 2020, 07:55 AM
seems to work fine I just figured it out. Rather than inserting the columns from NEW into the Temporary Table, I insert the NEW record as a single column into the Temporary Table and refer to it as RecordVar."NEW" inside my function. My rule and function now look like this:
From within an Update rule:
code :
SELECT NEW AS "NEW" INTO TEMPORARY TABLE TempTable;
SELECT MyFuction();
DECLARE RecordVar Record;
SELECT * INTO STRICT RecordVar FROM TempTable;
EXECUTE 'UPDATE AnotherTable SET column = $1.name' USING RecordVar."NEW";

Selecting data frame columns by column name variable


By : user1400856
Date : March 29 2020, 07:55 AM
wish help you to fix your issue My favourite old matrix-indexing will take care of this. Just pass a 2-column matrix with the respective row/column index:
code :
rownames(dframe) <- seq_len(nrow(dframe))
dframe[cbind(rownames(dframe),colname)]
#[1] 1 5 3
dframe[cbind(seq_len(nrow(dframe)), match(colname,names(dframe)))]
#[1] 1 5 3

selecting columns using below code but getting only top row


By : user2581538
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further If you want to select specific columns, add those columns names into a list and pass that:
code :
col_list = ['Subject', 'Original Sub-Component']
data1 = data.loc[:, col_list]
data1 = data.iloc[:, 3:8]

SQL code for selecting values not present in other columns


By : Anup Deshpande
Date : March 29 2020, 07:55 AM
it helps some times You should replace OR with AND condition to ensure the mobile number is not available in any of the four columns.
code :
SELECT u.agreementnumber, 
   SUBSTR(telephone, -10) AS telephone, 
   p.contact1, 
   p.contact2, 
   p.mobile1, 
   p.mobile2
FROM BIUSR.TBL_TRN_CIBIL_ID_DETAILS u
LEFT JOIN cust_agmt_CA p ON u.agreementnumber = p.agmtno
WHERE(u.telephone != p.mobile1)
 AND (u.telephone != p.mobile2)
 AND (u.telephone != p.contact1)
 AND (u.telephone != p.contact2);
shadow
Privacy Policy - Terms - Contact Us © voile276.org