access database string criteria [duplicate] - sql

This question already has an answer here:
Case sensitive WHERE in Access 2010
(1 answer)
Closed 6 months ago.
when using sql in access database, for string criteria, is it case sensitive? e.g. where PersonName like "LINDA", is equal to: where PersonName like "linda"?

You could use the StrComp function in an Access query
SELECT tblSource.ID, tblSource.Test
FROM tblSource
WHERE (((StrComp([tblSource].[Test],"LINDA",0))=0));
This will return only the rows with LINDA, it will not return Linda or LInda etc.

Related

Combine 3 records into one by appending data [duplicate]

This question already has answers here:
Combine values from related rows into a single concatenated string value
(1 answer)
SQL Query to Group By and Concat rows
(1 answer)
Closed 2 years ago.
I've been asked to take an MSAccess query with results like this:
Name Age Skills
Jim 42 Access
Jim 42 Excel
Jane 38 Access
And turn it into this:
Name Age Skills
Jim 42 Access, Excel
Jane 38 Access
I have no idea where to start with something like this, or if it can be done. Doesn't matter if it's a query or if I have to write a function, so long as the results are the same. Can anyone help?

Concatenate multiple rows to one row [duplicate]

This question already has answers here:
Simulating group_concat MySQL function in Microsoft SQL Server 2005?
(12 answers)
SQL Server: Combine multiple rows into one row from a join table?
(1 answer)
ListAGG in SQLSERVER
(4 answers)
how to stuff date and time in SQL
(2 answers)
Query to get multiple row into single row
(3 answers)
Closed 3 years ago.
I have the below data and I have to concatenate the long text column and make it as a single row. The challenge part is only one row has the notification number and other rows are null. You cannot group by the notification number.
I need the output as 2 rows
row number Notification Number Plant Creation Date Language Lineno Tag Long Text
1 10014354914 A057 43466 EN 1 >X aaabbbcccdddeeefffggghhhjjjkkklll
2 10014354915 A057 43466 EN 1 >X aaabbbcccdddeeefffgggpppqqqrrrsss
I have used cursor for this. But it is taking much time.
If you are using oracle:
with data("row number", "Notification Number","Plant","Creation Date","Language","Lineno","Tag","Long Text") as (
select 1,10014354914,'A057',43466,'EN',1,'>X','aaabbbcccdddeeefffggghhhjjjkkklll' from dual
union all
select 2,10014354915,'A057',43466,'EN',1,'>X','aaabbbcccdddeeefffgggpppqqqrrrsss' from dual)
select LISTAGG("Long Text",'') within group (order by "row number") from data;
if you are using ms-sql maybe try this:
SELECT u.[Long Text] AS [text()]
FROM yourtable u
ORDER BY u.[row number]
FOR XML PATH ('')

Its like transpose rows to columns in DB2 while we can't use aggregation [duplicate]

This question already has answers here:
Coalescing values in a column over a partition
(3 answers)
Closed 4 years ago.
I have a table as below
Element Value
State GA
State CA
State IL
And so on ....
I need to transpose above output as follows. It's similar to transposing, but little different as I need comma separated columns.
Element Value
State GA,CA,IL
Can someone help me to achieve above result in db2?
I got the answer with the help of #mustaccio
used listagg function..

BigQuery array intersect [duplicate]

This question already has an answer here:
BigQuery check for array overlap
(1 answer)
Closed 5 years ago.
I have an array of values I'd like to filter results for if an array column contains any of these values, is there an easy way to perform an intersect in BigQuery using the standard SQL language?
This should give you the general direction:
SELECT ...
WHERE EXISTS(SELECT 1 FROM UNNEST(array_column) a WHERE a IN UNNEST(array_values))

fetch values into a comma separated string in postgresql [duplicate]

This question already has answers here:
Postgresql GROUP_CONCAT equivalent?
(9 answers)
Closed 7 years ago.
This should be simple one. A query like
SELECT code_id FROM code WHERE status = 1
gives normally a result like
code_id
10
11
12
But my goal is to fetch into a string like
10,11,12
In order to use it in an other query
SELECT x FROM table WHERE status in (10,12,13)
Preferable in the same query. Is this possible using "standard" Postgresql WITHOUT adding extra extension?
Everything so far is using extension that not are available as standard.
Thanks in advance.
Whatever tool you are using just shows you the data like that for convenience. But you can also use the resultset in a subquery, like this
SELECT x FROM table WHERE status in (
SELECT code_id FROM code WHERE status = 1
)
You can try this way to get result as comma-separated
But my goal is to fetch into a string like
SELECT string_agg(code_id, ',') FROM code WHERE status = 1