Click here to Skip to main content
15,885,985 members
Home / Discussions / Database
   

Database

 
QuestionSQL Interview Pin
Member 1417944312-Apr-19 3:38
Member 1417944312-Apr-19 3:38 
AnswerRe: SQL Interview Pin
Richard MacCutchan12-Apr-19 6:34
mveRichard MacCutchan12-Apr-19 6:34 
GeneralRe: SQL Interview Pin
Member 1417944312-Apr-19 22:36
Member 1417944312-Apr-19 22:36 
GeneralRe: SQL Interview Pin
Richard MacCutchan12-Apr-19 23:20
mveRichard MacCutchan12-Apr-19 23:20 
GeneralRe: SQL Interview Pin
Eddy Vluggen16-Apr-19 2:54
professionalEddy Vluggen16-Apr-19 2:54 
AnswerRe: SQL Interview Pin
#realJSOP16-Apr-19 2:00
mve#realJSOP16-Apr-19 2:00 
QuestionQuerying from multiple tables at the same time - related to correlated subqueries Pin
User 141845817-Apr-19 5:12
User 141845817-Apr-19 5:12 
AnswerRe: Querying from multiple tables at the same time - related to correlated subqueries Pin
Mycroft Holmes7-Apr-19 12:08
professionalMycroft Holmes7-Apr-19 12:08 
You are going to have to split this into a query and a sub query (unless Richard comes in with a CTE).

Sub query should be everyting EXCEPT
AVG (Enrollment.Marks_obtained = 1/3 * avg_second_year_marks + 2/3 * avg_third_year_marks) AS Overall_Marks
The averaging variables do not exist in the current structure until AFTER the query is run.

Then try:
Select *
from (put the sub query here) as SQ

You can then add the totaling column after the * because the subquery would have been run and the averaging values populated.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP

AnswerRe: Querying from multiple tables at the same time - related to correlated subqueries Pin
Eddy Vluggen8-Apr-19 0:44
professionalEddy Vluggen8-Apr-19 0:44 
AnswerRe: Querying from multiple tables at the same time - related to correlated subqueries Pin
CHill6011-Apr-19 6:48
mveCHill6011-Apr-19 6:48 
QuestionHELP WITH SQL QUERY Pin
BrunoPigeon4-Apr-19 17:37
BrunoPigeon4-Apr-19 17:37 
AnswerRe: HELP WITH SQL QUERY Pin
Mycroft Holmes4-Apr-19 20:38
professionalMycroft Holmes4-Apr-19 20:38 
GeneralRe: HELP WITH SQL QUERY Pin
BrunoPigeon4-Apr-19 20:56
BrunoPigeon4-Apr-19 20:56 
GeneralRe: HELP WITH SQL QUERY Pin
GuyThiebaut4-Apr-19 21:06
professionalGuyThiebaut4-Apr-19 21:06 
GeneralRe: HELP WITH SQL QUERY Pin
BrunoPigeon4-Apr-19 21:10
BrunoPigeon4-Apr-19 21:10 
GeneralRe: HELP WITH SQL QUERY Pin
GuyThiebaut4-Apr-19 21:20
professionalGuyThiebaut4-Apr-19 21:20 
GeneralRe: HELP WITH SQL QUERY Pin
GuyThiebaut4-Apr-19 21:43
professionalGuyThiebaut4-Apr-19 21:43 
AnswerRe: HELP WITH SQL QUERY Pin
GuyThiebaut4-Apr-19 20:56
professionalGuyThiebaut4-Apr-19 20:56 
GeneralRe: HELP WITH SQL QUERY Pin
BrunoPigeon4-Apr-19 20:58
BrunoPigeon4-Apr-19 20:58 
GeneralRe: HELP WITH SQL QUERY Pin
Mycroft Holmes4-Apr-19 21:16
professionalMycroft Holmes4-Apr-19 21:16 
GeneralRe: HELP WITH SQL QUERY Pin
GuyThiebaut4-Apr-19 21:24
professionalGuyThiebaut4-Apr-19 21:24 
GeneralRe: HELP WITH SQL QUERY Pin
BrunoPigeon5-Apr-19 0:13
BrunoPigeon5-Apr-19 0:13 
GeneralRe: HELP WITH SQL QUERY Pin
GuyThiebaut4-Apr-19 21:17
professionalGuyThiebaut4-Apr-19 21:17 
GeneralRe: HELP WITH SQL QUERY Pin
BrunoPigeon5-Apr-19 0:11
BrunoPigeon5-Apr-19 0:11 
GeneralRe: HELP WITH SQL QUERY Pin
GuyThiebaut5-Apr-19 2:48
professionalGuyThiebaut5-Apr-19 2:48 

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.