knowledge-database (beta)

Current group: comp.soft-sys.matlab

Using multiple variables in SQL query with Databas

Using multiple variables in SQL query with Databas  
b allesandri
 Re: Using multiple variables in SQL query with Databas  
Christopher Smith
From:b allesandri
Subject:Using multiple variables in SQL query with Databas
Date:Sun, 23 Jan 2005 13:44:04 -0500
When using the Database Toolbox I have the following problem.
How to build a query when using more variables in my sql request.
After looking at help on Matlab 7.0 I have been able to successfuly
use one variable.

Here is a query that I am unable to get running.

curs = exec(conn, ['select * from market where Place = '' AND
MonthName='' AND Year='' ', city,'''',month,'''',year,''''])

Thank you all very much for any suggestions.

B. A.
From:Christopher Smith
Subject:Re: Using multiple variables in SQL query with Databas
Date:Sun, 23 Jan 2005 14:25:33 -0500
b allesandri wrote:
>
>
> When using the Database Toolbox I have the following problem.
> How to build a query when using more variables in my sql request.
> After looking at help on Matlab 7.0 I have been able to successfuly
> use one variable.
>
> Here is a query that I am unable to get running.
>
> curs = exec(conn, ['select * from market where Place = '' AND
> MonthName='' AND Year='' ', city,'''',month,'''',year,''''])
>
> Thank you all very much for any suggestions.
>
> B. A.

try:
curs = exec(conn, ['select * from market where Place = ', city ,' AND
MonthName= ',month,year]);

This assumes all the above are already strings. If not, you'll need
num2str() for non character variables.

C.
   

Copyright © 2006 knowledge-database   -   All rights reserved