Click here to Skip to main content
15,847,963 members
Home / Discussions / Database
   

Database

 
QuestionHow to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
Robymon6-Jun-14 0:03
Robymon6-Jun-14 0:03 
SuggestionRe: How to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
GuyThiebaut6-Jun-14 1:55
professionalGuyThiebaut6-Jun-14 1:55 
GeneralRe: How to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
Robymon6-Jun-14 3:19
Robymon6-Jun-14 3:19 
GeneralRe: How to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
GuyThiebaut6-Jun-14 3:24
professionalGuyThiebaut6-Jun-14 3:24 
GeneralRe: How to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
ZurdoDev6-Jun-14 3:49
professionalZurdoDev6-Jun-14 3:49 
AnswerRe: How to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
Eddy Vluggen6-Jun-14 3:36
professionalEddy Vluggen6-Jun-14 3:36 
AnswerRe: How to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
PIEBALDconsult6-Jun-14 15:38
mvePIEBALDconsult6-Jun-14 15:38 
QuestionSQLite query Pin
David Crow5-Jun-14 11:38
David Crow5-Jun-14 11:38 
I have the following three tables:

TABLE_A        TABLE_B               TABLE_C
-------        ---------             -------
id (primary)   tablea_id (foreign)   tablea_id (foreign)
name           boards                text
date
phone


I have the following query to select all rows from TABLE_A and also count how many related rows are in each of the other two tables:

SELECT *, (SELECT COUNT(TABLE_B.tablea_id) FROM TABLE_B WHERE TABLE_B.tablea_id == TABLE_A.id) AS Cnt1, (SELECT COUNT(TABLE_C.tablea_id) FROM TABLE_C WHERE TABLE_C.tablea_id == TABLE_A.id) AS Cnt2 FROM TABLE_A


This works fine, but I was curious if: 1) SQL was doing three separate queries behind the scene, and 2) a more efficient way exists.

Thank you.
- DC

"One man's wage rise is another man's price increase." - Harold Wilson

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles


AnswerRe: SQLite query Pin
Mycroft Holmes5-Jun-14 13:47
professionalMycroft Holmes5-Jun-14 13:47 
GeneralRe: SQLite query Pin
David Crow5-Jun-14 18:38
David Crow5-Jun-14 18:38 
QuestionQuestion on Canidate keys and functional dependecies Pin
Member 108651294-Jun-14 17:35
Member 108651294-Jun-14 17:35 
AnswerRe: Question on Canidate keys and functional dependecies Pin
Eddy Vluggen5-Jun-14 9:05
professionalEddy Vluggen5-Jun-14 9:05 
AnswerRe: Question on Canidate keys and functional dependecies Pin
Eddy Vluggen7-Jun-14 0:39
professionalEddy Vluggen7-Jun-14 0:39 
QuestionIssue deploying SSIS Package in production web server Pin
Shuaib Kaniyar4-Jun-14 1:46
Shuaib Kaniyar4-Jun-14 1:46 
Question+ operaotor for outer joins in mysql. Pin
aghori3-Jun-14 20:55
aghori3-Jun-14 20:55 
AnswerRe: + operaotor for outer joins in mysql. Pin
Jörgen Andersson3-Jun-14 22:16
professionalJörgen Andersson3-Jun-14 22:16 
SuggestionData Mining Structure not Available in SSAS Tabular Model Pin
FLouis382-Jun-14 7:14
professionalFLouis382-Jun-14 7:14 
QuestionReady to give up on MySQL - is PostgreSQL better? Pin
Wombaticus1-Jun-14 23:09
Wombaticus1-Jun-14 23:09 
AnswerRe: Ready to give up on MySQL - is PostgreSQL better? Pin
Jörgen Andersson1-Jun-14 23:37
professionalJörgen Andersson1-Jun-14 23:37 
GeneralRe: Ready to give up on MySQL - is PostgreSQL better? Pin
Wombaticus1-Jun-14 23:43
Wombaticus1-Jun-14 23:43 
GeneralRe: Ready to give up on MySQL - is PostgreSQL better? Pin
Jörgen Andersson2-Jun-14 0:08
professionalJörgen Andersson2-Jun-14 0:08 
QuestionA query with lot of inner queries Pin
indian14329-May-14 13:41
indian14329-May-14 13:41 
AnswerRe: A query with lot of inner queries Pin
Mycroft Holmes29-May-14 14:02
professionalMycroft Holmes29-May-14 14:02 
GeneralRe: A query with lot of inner queries Pin
indian14329-May-14 14:09
indian14329-May-14 14:09 
GeneralRe: A query with lot of inner queries Pin
Mycroft Holmes29-May-14 15:08
professionalMycroft Holmes29-May-14 15:08 

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.