Click here to Skip to main content
16,011,374 members
Home / Discussions / Database
   

Database

 
GeneralSQL Help. Pin
brdavid4-Jul-04 14:59
brdavid4-Jul-04 14:59 
GeneralRe: SQL Help. Pin
Hesham Amin4-Jul-04 22:50
Hesham Amin4-Jul-04 22:50 
GeneralRe: SQL Help. Pin
brdavid6-Jul-04 4:49
brdavid6-Jul-04 4:49 
GeneralRe: SQL Help. Pin
Grimolfr6-Jul-04 9:58
Grimolfr6-Jul-04 9:58 
GeneralRe: SQL Help. Pin
brdavid6-Jul-04 14:00
brdavid6-Jul-04 14:00 
GeneralEditing Pre-existing Queries Pin
brdavid4-Jul-04 14:56
brdavid4-Jul-04 14:56 
GeneralVariable in SQL Query Pin
brdavid4-Jul-04 2:01
brdavid4-Jul-04 2:01 
GeneralRe: Variable in SQL Query Pin
Colin Angus Mackay4-Jul-04 2:27
Colin Angus Mackay4-Jul-04 2:27 
brchris wrote:
Is it possible to list a field value as a value in an SQL query?

No you can't


brchris wrote:
If not, does anyone know another possible solution?

Use stored procedures. You can write a stored procedure to query the first table, create a string that contains the second query and return the result back - this will mean you only need to call the database once. It is still inefficient as the query optimiser can't pre-optimise a stored procedure that is executining a string as it has to parse the string at runtime, rather than at compile time. But at least it will cut down on database calls and network roundtrips and so on.

brchris wrote:
I make probably 500 SQL calls in a single function thanks to this database design

You could extend stored procedure approach, if possible, and do everything from one call. Of course, your database design may not allow it, but it would be worth seeing if there is anything that could be suitably grouped as stored procedures are much more efficient and have added security benefits (you can deny direct access to tables and route all queries/inserts/updates/deletes through stored procedures, which means you always know what queries are being executed)

Does this help?


"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar

The Second EuroCPian Event will be in Brussels on the 4th of September

Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!

My Blog


GeneralRe: Variable in SQL Query Pin
brdavid4-Jul-04 5:46
brdavid4-Jul-04 5:46 
Generalrunning mysql_install_db on windows Pin
Hesham Amin4-Jul-04 0:43
Hesham Amin4-Jul-04 0:43 
GeneralRe: running mysql_install_db on windows Pin
michanne4-Jul-04 18:00
michanne4-Jul-04 18:00 
GeneralRe: running mysql_install_db on windows Pin
Hesham Amin4-Jul-04 22:23
Hesham Amin4-Jul-04 22:23 
GeneralRe: running mysql_install_db on windows Pin
michanne15-Jul-04 6:29
michanne15-Jul-04 6:29 
GeneralRe: running mysql_install_db on windows Pin
Grimolfr6-Jul-04 10:05
Grimolfr6-Jul-04 10:05 
Generaldataview Pin
Member 11412663-Jul-04 0:41
Member 11412663-Jul-04 0:41 
QuestionWhat is the main advantage of subqueries? Pin
wgdesigner2-Jul-04 22:31
wgdesigner2-Jul-04 22:31 
GeneralStored Procedure call yields RecordSet error Pin
Peter Weyzen2-Jul-04 8:29
Peter Weyzen2-Jul-04 8:29 
GeneralRe: Stored Procedure call yields RecordSet error Pin
Steven Campbell2-Jul-04 11:19
Steven Campbell2-Jul-04 11:19 
GeneralRe: Stored Procedure call yields RecordSet error Pin
Peter Weyzen2-Jul-04 11:52
Peter Weyzen2-Jul-04 11:52 
GeneralCould use an extra brain... Pin
brdavid2-Jul-04 6:31
brdavid2-Jul-04 6:31 
GeneralRe: Could use an extra brain... Pin
Steven Campbell2-Jul-04 11:15
Steven Campbell2-Jul-04 11:15 
GeneralRe: Could use an extra brain... Pin
brdavid2-Jul-04 14:53
brdavid2-Jul-04 14:53 
GeneralSQL query required Pin
Imtiaz Murtaza1-Jul-04 23:02
Imtiaz Murtaza1-Jul-04 23:02 
GeneralRe: SQL query required Pin
wgdesigner2-Jul-04 22:23
wgdesigner2-Jul-04 22:23 
GeneralRe: SQL query required Pin
Go2Canada5-Jul-04 3:07
sussGo2Canada5-Jul-04 3:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.