How to pull multiple records using SQL statement?

Thanks in advance for your help.

I am working with an application that the user has developed. It offers you to search for something, and then performs the main query:

SELECT * FROM Table
WHERE Entry=[ENTRY];

I can not change this format. All I can do is change the text [ENTRY]. Is there a way that I can pull out multiple records without changing the structure of the statement itself? For instance:

SELECT * FROM Table
WHERE Entry='COW | APPL* | ROO*';

to get the results:

COW, APPLE, APPLES, ROOF, ROOM, ROOSTER;

Sorry, please, the simplest example - Thank you,

Blake

+4
source share
4 answers

It completely depends on the code. If possible, you can use the Sql injection method to request multiple records.

SELECT * FROM Table
WHERE Entry='COW' OR Entry ='APPL' OR Entry = 'ROO';

, [ENTRY] :

[ENTRY] = "'COW' OR Entry ='APPL' OR Entry = 'ROO'";

, , [ENTRY] SQL-.

EDIT: , sql, : :

COW' OR 1 = '1
+3

SQL-, ; .

= IN.

+2

SQL- , SQL- :

COW' OR Entry = 'APPL%' OR Entry = 'ROO%

SQL :

SELECT * 
FROM Table 
WHERE Entry='COW' OR Entry = 'APPL%' OR Entry = 'ROO%';
+2

. , , , . lol.

, "Entry" :

[Entry] = COW' OR WHERE Entry='APPL*' OR WHERE Entry='ROO*

SQL :

SELECT * FROM Table
WHERE Entry='COW' OR WHERE Entry='APPL*' OR WHERE Entry='ROO*';

, .

0

Source: https://habr.com/ru/post/1546041/


All Articles