필터 지우기
필터 지우기

Selecting from database using multiple conditions (SQL)

조회 수: 4 (최근 30일)
John Doe
John Doe 2020년 4월 8일
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.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by