D T
D T

Reputation: 3756

How select data in postgresql?

I have a table as: T(Id integer,Col1 text) In table T has data:

enter image description here

Row 1:
Id= 1
Col1="abc"

Row 2:
Id=2
Col1="940
920
900
880
860

840
820
800
780
760

740
720
700
690
680

670
660
650
640
630

620
610
600
590
580

570
560
550
540
530

520
510
500
490
480

470
460
450
440
430

420
410
400
390
380

370
360
350
340
330"

I have a query is:

SELECT
  *
FROM
  T
where Col1 = '940
920
900
880
860

840
820
800
780
760

740
720
700
690
680

670
660
650
640
630

620
610
600
590
580

570
560
550
540
530

520
510
500
490
480

470
460
450
440
430

420
410
400
390
380

370
360
350
340
330'

Query doesn't return row 2. Why? can you help me? Thanks all.

Upvotes: 2

Views: 105

Answers (1)

Tomas Greif
Tomas Greif

Reputation: 22661

I'm posting this as answer only because my comment is too long. The following works in PostgreSQL so I guess it does not work for you because strings are not the same.

create table a (a varchar);

insert into a values('940
920
900
880
860

840
820
800
780
760

740
720
700
690
680

670
660
650
640
630

620
610
600
590
580

570
560
550
540
530

520
510
500
490
480

470
460
450
440
430

420
410
400
390
380');

select * from a where a = '940
920
900
880
860

840
820
800
780
760

740
720
700
690
680

670
660
650
640
630

620
610
600
590
580

570
560
550
540
530

520
510
500
490
480

470
460
450
440
430

420
410
400
390
380';

Upvotes: 1

Related Questions