multiple singletons in one select?

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
guidoaerts
Senior Boarder
Senior Boarder
Posts: 93
Joined: 01.07.2009, 16:07

multiple singletons in one select?

Post 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
Wild_Pointer
Expert Boarder
Expert Boarder
Posts: 164
Joined: 18.03.2008, 13:03
Contact:

Post by Wild_Pointer »

hi, guidoaerts,

try SELECT table1.column, table2.column from table1, table2 where table1.id = 1 and table2.id = 2
guidoaerts
Senior Boarder
Senior Boarder
Posts: 93
Joined: 01.07.2009, 16:07

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Guido,

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

Mark
Image
guidoaerts
Senior Boarder
Senior Boarder
Posts: 93
Joined: 01.07.2009, 16:07

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
guidoaerts
Senior Boarder
Senior Boarder
Posts: 93
Joined: 01.07.2009, 16:07

Post by guidoaerts »

Ok. Thanks.
Post Reply