I am not so into SQL and I have the following problem.
I havve write this simple JOIN query:
select a.nome, a.cognome from Banker b
INNER JOIN Anagrafica a
ON b.AnagraficaID = a.ID
INNER JOIN Polizza p
ON p.BankerID = b.ID
WHERE p.ID LIKE "7%"
My problem is on the last WHRE clause. I want that the where condition is that all the returned records have to start with the digit 7 but I obtain this error message:
14:59:07 [SELECT - 0 row(s), 0.000 secs] [Error Code: 207, SQL State: S0001] Invalid column name '7%'.
... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 1 errors]
I think that it could depend because the ID field of the Polizza table is a bigint and not a varchar.
So how can I implement this thing on this type of field? I need that it return only record having the the ID field of the Polizza table that starts with 7
SQL Server uses single quotes to wrap strings
select a.nome, a.cognome from Banker b
INNER JOIN Anagrafica a
ON b.AnagraficaID = a.ID
INNER JOIN Polizza p
ON p.BankerID = b.ID
WHERE p.ID LIKE '7%'