Borrar filtros
Borrar filtros

Selecting from database using multiple conditions (SQL)

4 visualizaciones (últimos 30 días)
John Doe
John Doe el 8 de Abr. de 2020
Hi everyone,
How can I fetch data from the database with multiple conditions that tend to change in my loop.
For example, for one this is what i do
ProjectName = XXX;
a = strcat('''', ProjectName, '''');
curs = ['SELECT ID from Table1 WHERE ProjectName =',a]; cursVessel = fetch(conn,curs);
Now if I want the ID numbers where my ProjectName = XXX, and Country = YYY; How can I do that?. My project name and country would change within a loop that's why I can't say
curs = ['SELECT ID from Table1 WHERE ProjectName =''XXX'' and Country = ''YYY''']; cursVessel = fetch(conn,curs);
Thank you in advance,
If any clarifications is needed, please let me know.

Respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by