Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Trying to get rid of a space.
Current Results:
P O BOX 140
Desired Results:
PO BOX 140
--This script did not work
update table
set column= replace(column, 'P O', 'PO')
from table
Something simple if the space is always the 2nd position....
take the left most character add the right most characters -1 for first letter and -1 for the space.
Select left('P O BOX 140',1) + right('P O BOX 140',len('P O BOX 140')-2) as NoO
...
WHERE UPPER(FieldText) Like 'P O%'
http://sqlfiddle.com/#!6/2a2dd/4/0
you could add some where clause limits to ensure the first character is P and the 3rd is O as well..
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Team Table
Player (column)
A
B
C
Expected Output: with Two columns
Player vsPlayer
A B
B C
C A
How to write a sql query to get the exact output as Expected output mentioned above.
Thanks in advance
The normal way to get combination (pairs) is to take all permutations, but where column 1 is less than column 2.
SELECT
l.player,
r.player
FROM
player l
INNER JOIN
player r
ON l.player < r.player
Demo : https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=9ce7af3d0afe89c6434cc2800dfbd2ef
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am trying to sum the frequency of the words cumulatively in PostgreSQL
Here's my table (example)
I need sum accumulative frequency for same words, for example the expected results is:
resize (100 + 85) = 185
trabajar (75 + 73) = 148
partir (64) = 64
How can I make the query?
you need to use GROUP BY :
SELECT
word
, SUM(frecuency)
FROM tablename
GROUP BY word
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Fieldname: DCCD
Characters in field: BAS XXXX 290 B2D explanation
I need the XXXX and want to place them in a seperate column.
The first group (ex. BAS) are always 3 characters
The The XXXX can have 2, 3 or 4 characters
The third group have 2 or 3 karakters
Between the groups there's always a space (spatie)
I got this code but it doesn't work. Can someone please help me. I don't know anything about this and I speak dutch :-)
LEFT(RIGHT([DCCD], (LEN([DCCD]) - SEARCH(" ", [DCCD]))), SEARCH(" ", RIGHT([DCCD], (LEN([DCCD]) - SEARCH(" ", [DCCD])))))
Use CHARINDEX() to find the ' ' in a string, start looking at position 5. Use SUBSTRING() to return from position 5.
substring(DCCD, 5, CHARINDEX(' ', DCCD, 5) -5)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have to concatenate 10 different fields in the same table. After the field concatenated, I need to eliminate the space between all characters. 30,000
records.
CUSTOMER # FIELD 1 FIELD 3 FIELD 4 FIELD 5 FIELD 6 FIELD XX
,TO BE OR NOT, /THAT IS/ /THE Q/ OR NOT THE_ QUESTION
So, it would like like:
,TOBEORNOT,/THAT IS//THEQ/ORNOTTHE_QUESTION
With concat and replace:
select
replace(concat(field1, field2,....), ' ', '')
from customer
To count the characters use len:
select
len(replace(concat(field1, field2,....), ' ', '')) counter
from customer
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have a table in a SQL Server 2000 database with a column with several entries like 01-03, 04-05. The first 2 digits are the room number and the last two digits are the bed number.
I want to replace the 01-05, 03-07 etc. with only the bed number. So only the last two charcters have to be in the column.
How do I accomplish this?
Sample data is:
In the column [Bed] with values:
22-01
08-01
09-03
01-16
Result has to be:
01
01
03
16
RIGHT should solve your problem:
SELECT RIGHT(RTRIM(Bed), 2) FROM tbl