How to determine the column with multiple items of data has one specified value in BigQuery? - sql

This is my table:
I want to change the TargetCondition column to 'TRUE' when the ICD9CODE column contains a particular range (like between 250 and 250.93).
Please help me do it. Thanks
This is the code here:
update demo.fea_02 set TargetCondition = TRUE where ICD9Code like between '%250%' and '%250.93%'
got the error:
Syntax error: Unexpected keyword BETWEEN at [6:17]

This answers the original version of the question.
You would use update:
update mytable
set targetcondition = 'TRUE'
where icd9code like '%value%';

Related

ERROR: syntax error at or near | modify('replace value of | PostgresSql

I am trying to write a query for updating xml column value it may have or may not have an existing value. I have tried this query but it is giving me syntax error don't know why. I am not SQL expert i am just working with existing code.
Error
ERROR: syntax error at or near "("
LINE 4: SET user_prop.modify('replace value of ("//PREF/NOTIFICATION...
^
SQL state: 42601
Character: 199
Query
UPDATE user
SET user_prop.modify('replace value of ("//PREF/NOTIFICATIONS/#ASK_YOUR_INSTR") with ("TRUE")') where username='1038125#';
XML Value
<PROP>
<ACL DENY="CREATECOURES"></ACL>
<PREF>
<NOTIFICATIONS ASK_YOUR_INSTR="FALSE" />
</PREF>
</PROP>
The SET part of an UPDATE needs an assignment, e.g.
update foo
set bar = bar + 1
where id = 1;
You haven't told us what your function modify() does, but if it returns the modified XML value, then I guess you are looking for:
UPDATE user
SET the_column = user_prop.modify('....')
where username='1038125#';
I guess this is the answer
UPDATE HR_XML
SET Salaries.modify('replace value of
(/Salaries/Marketing/Employee[#ID=("2")]/Salary/text())[1] with ("60000")')
can you try to remove the quotes from the //PREF/NOTIFICATIONS/#ASK_YOUR_INSTR

Invalid number string (7498) JDBC Request

I'm converting this progress statement into SQL.
for each usr_mstr where usr_userid matches "PRF52" exclusive-lock:
assign usr_force_change = no.
end.
This is what I currently have.
UPDATE PUB.usr_mstr SET usr_force_change = 'false' WHERE usr_userid = 'PRF52'
The error that I am receiving is '[DataDirect][OpenEdge JDBC Driver][OpenEdge] Invalid number string (7498)'.
A select statement for this field is working and returns the following.
SELECT usr_force_change FROM PUB.usr_mstr WHERE usr_userid = 'PRF52'
usr_force_change
false
The column data type was of type 'LOGICAL'. This translates to type 'BIT' in SQL. I updated the statement to the following at it worked.
UPDATE PUB.usr_mstr SET usr_force_change = '0' WHERE usr_userid = 'PRF51'
You need to choose Query type as Update Statement when submit update
Update Statement - use this for Inserts and Deletes as well

UPDATE QUERY - Sum up a value from form with value from table

I've just started using microsoft access so I don't really know how to solve this. I would like to use an update query to add a value from a form to a value on a table.
I originally used the SUM expression which gave me an error saying it was an aggregate function.
I also tried to add the two values together (e.g [field1] + [field2]) which as a result gave me a value with both numbers together instead of adding them together.
The following is the SQL I'm using:
UPDATE Votes
SET Votes.NumVotes = [Votes]![NumVotes]+[Forms]![frmVote]![txtnumvotes]
WHERE (((Votes.ActID) = [Forms]![frmVote]![combacts])
AND ((Votes.RoundNum) = [Forms]![frmVote]![combrndnum]))
I want to add a value [txtnumvotes] a form to a field [NumVotes] from the table [Votes].
Could someone please help me?
You can specify the expected data type with parameters:
PARAMETERS
[Forms]![frmVote]![txtnumvotes] Short,
[Forms]![frmVote]![combacts] Long,
[Forms]![frmVote]![combrndnum] Long;
UPDATE
Votes
SET
Votes.NumVotes = [Votes]![NumVotes]+[Forms]![frmVote]![txtnumvotes]
WHERE
(((Votes.ActID) = [Forms]![frmVote]![combacts])
AND
((Votes.RoundNum) = [Forms]![frmVote]![combrndnum]))
Without the specification, Access has to guess, and that sometimes fails.

Update date within a table, Postgresql

So I'm having trouble understanding on how to change the date on an update in postgres. What I have currently, that is giving a syntax error is
UPDATE works_locations SET (wrl_startdate = '2014-09-07', wrl_enddate = '2015-02-06')
with a few statements determining which field I should specifically change. However, postgres is giving me an error. How do I successfully change the date in postgres, even if the start date is around two years prior to this entry?
I don't have Postgres installed so I can't test this but try removing the parenthesis on your SET clause so that it looks like this:
UPDATE works_locations SET wrl_startdate = '2014-09-07', wrl_enddate = '2015-02-06'

Update Field Geometry Polygon PostGIS PostgreSQL

I am having some trouble trying to update a field.
I created a column as text and stored many rows with (lon,lat). Now I have created one more field as Geometry(Polygon) and I am trying to update it unsuccessfully.
The data is stored like this:
POLYGON ((-16.6318775869111 -52.5925428149806, -16.6346393504709 -52.572542814981
, -16.629462102066 -52.5525428149806, -16.6255191065928 -52.5455420519144
, -16.6055191065928 -52.5488828022871, -16.6021791014778 -52.552542814981
, -16.6108484688169 -52.5925428149806, -16.6255191065928 -52.599495926874
, -16.6318775869111 -52.5925428149806))
I am trying this command
UPDATE field_as_text
SET field_as_geomtry = SELECT ST_GeomFromText(SELECT field_as_text);
I am getting this error message
ERROR: syntax error at or near "select"
LINE 1: ... set field_as_geomtry = select (ST...
Could anyone enlighten me?
You need to start by reading the manual about the SQL UPDATE command.
Should look something like this:
UPDATE table_name
SET field_as_geomtry = ST_GeomFromText(field_as_text);