If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > no result for 27 columns

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-23-09, 03:23
homer.favenir homer.favenir is offline
Registered User
 
Join Date: Oct 2007
Location: Manila, Philippines
Posts: 132
no result for 27 columns

hi,
please can anyone help me
i have query with 27 columns,
but no results was returned
however, if i remove 1 column ( 26 columns ) it return the results,
and if i add a column ( 28 columns ) it also return the results.

any ideas guys? (

Code:
SELECT
a.idgrading_sheet
,a.SchoolYr
,a.GradingPeriod
,a.`Yr/Section`
,a.`subject`
,a.teacher
,a.StudentName
,a.PerT
,a.Recitation
,a.Quiz
,a.LongQuiz
,a.Project
,a.Assignment
,( SELECT distinct R FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'PerT') AS 'PerT(R)'
,( SELECT distinct E FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'PerT') AS 'PerT(E)'
,( SELECT distinct R FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'Recitation') AS 'Recit(R)'
,( SELECT distinct E FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'Recitation') AS 'Recit(E)'
,( SELECT distinct R FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'Quiz') AS 'Quiz(R)'
,( SELECT distinct E FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'Quiz') AS 'Quiz(E)'
,( SELECT distinct R FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'LongQuiz') AS 'LongQuiz(R)'
,( SELECT distinct E FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'LongQuiz') AS 'LongQuiz(E)'

,( SELECT distinct R FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'Project') AS 'Project(R)'
,( SELECT distinct E FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'Project') AS 'Project(E)'

,( SELECT distinct R FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'Assignment') AS 'Assignment(R)'
,( SELECT distinct E FROM subjpercentage_tbl
    WHERE GradingPeriod = a.GradingPeriod and SubjCode = a.`subject` and Assessment = 'Assignment') AS 'Assignment(E)'

,c.firstnumber
,c.secondnumber


FROM grading_sheettbl a
INNER JOIN subjpercentage_tbl b ON ( b.idsubject_tbl = a.idsubject_tbl )
INNER JOIN gradingformula_tbl c ON ( a.GradingPeriod = c.GradingPeriod )
where a.StudentName = 'Baik Sung Eun'

GROUP BY
a.`subject`
,a.gradingperiod
thanks
__________________
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
Reply With Quote
  #2 (permalink)  
Old 04-23-09, 03:31
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
The query you have posted is incomplete - you are grouping by subject and grading period but there are more non-aggrgated columns in your SELECT list.

Pleas post the actual query (and one of the working versions) please!
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 04-23-09, 06:50
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by gvee
you are grouping by subject and grading period but there are more non-aggrgated columns in your SELECT list.
and your point is...?

mysql allows this, it's a "feature"

see Debunking GROUP BY myths

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 04-23-09, 06:52
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
D'oh, I keep forgetting that one about MySQL - thanks for pointing that out Rudy
__________________
George
Twitter | Blog
Reply With Quote
  #5 (permalink)  
Old 04-23-09, 06:54
homer.favenir homer.favenir is offline
Registered User
 
Join Date: Oct 2007
Location: Manila, Philippines
Posts: 132
it is my actual script, and its working ( if i add another column or deduct a column )
anyway,
i will just remove a column from my script.

thanks
__________________
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
Reply With Quote
  #6 (permalink)  
Old 04-23-09, 07:01
homer.favenir homer.favenir is offline
Registered User
 
Join Date: Oct 2007
Location: Manila, Philippines
Posts: 132
but i just keep on thinking why does my script can't output result with just 27 columns..but with 26 or 28 columns it can...
hmmm....
__________________
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
Reply With Quote
  #7 (permalink)  
Old 04-24-09, 12:20
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
run your query directly in the mysql client with the 27 columns. do you get output? if so then the problem is in your front end application.

if you have errors in the mysql client when running the script point out the errors here.
Reply With Quote
  #8 (permalink)  
Old 04-24-09, 22:47
homer.favenir homer.favenir is offline
Registered User
 
Join Date: Oct 2007
Location: Manila, Philippines
Posts: 132
it has no errors in mysql, but it didnt give any results
__________________
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
Reply With Quote
  #9 (permalink)  
Old 04-25-09, 01:00
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,260
so the guess would be that the 27th column contains no data so the SQL engine returns nithign because there is nothing to retrun.

you could prove this by, say adding the colmn in another sequence. if it still returns no data then its not the fact its the 27th colmn in the list, but the fact there is no longer any data to return
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On