Selecting from database using multiple conditions (SQL)
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!