Page 1 of 1

multiple singletons in one select?

Posted: 09.02.2010, 19:31
by guidoaerts
hi,
I just can't find how to retrieve some column values from a single row in one table and, at the same time, some column values from a single row in a second non-related table. I could send two select statements, but that increases wlan traffic and time. Can i do it in one select?
guido

Posted: 10.02.2010, 08:10
by Wild_Pointer
hi, guidoaerts,

try SELECT table1.column, table2.column from table1, table2 where table1.id = 1 and table2.id = 2

Posted: 10.02.2010, 09:47
by guidoaerts
Thanks, Wild_Pointer,
that's perfect. Why can't I find this in tutorials? I suppose it is obvious to routined sql folks, but IMO one can't figure it out off the syntax definition.
Anyway, thanks.

Posted: 11.02.2010, 23:56
by mdaems
Guido,

Sorry, but we can't elaborate on pure sql issues. That's mainly the job of your database server manufacturer.

Mark

Posted: 15.02.2010, 10:13
by guidoaerts
mdaems wrote:Guido,

Sorry, but we can't elaborate on pure sql issues. That's mainly the job of your database server manufacturer.

Mark
Ok, Mark, sorry for being off topic. Yet I have another question :
For a query that returns just a few fields (like the one above), would it be better to use IZConnection, IZStatement and IZResultSet in stead off TZQuery, as in the example DbcDemoMain.pas in the zeos665\examples\dbc\ folder? As I connect over internet, I want to be as ergonomic as possible.
Guido

Posted: 15.02.2010, 22:10
by mdaems
Guido,

Using dbc or component layer is actually a matter of personal choice and the needs of your client program.
The network traffic should be identical when you retrieve all results of the query as the components actually just use the dbc layer internally.
In case you want to use db aware components on your forms you'll have to use components. If you're just handling the results using code both solutionw will do, but dbc has less client-side overhead. Network traffic is equal.

Mark

Posted: 19.02.2010, 19:29
by guidoaerts
Ok. Thanks.