2 Replies - 284 Views - Last Post: 11 July 2014 - 07:26 AM Rate Topic: -----

#1 emocrest  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-July 14

geting the last data from the database

Posted 10 July 2014 - 08:17 PM

I having problem with my code
im try to pull the last data from my data base
this my code
SELECT MAX(tb_cenorolstatus.ID) AS Expr1, tb_mstud.lname, tb_mstud.fname, tb_mstud.mname, tb_cenorolstatus.y_l,tb_cenorolstatus.c_sec, tb_cenorolstatus.d_sec, tb_cenorolstatus.sky, tb_cenorolstatus.level, tb_mstud.id_no
FROM  tb_cenorolstatus INNER JOIN
       tb_mstud ON tb_cenorolstatus.id_no = tb_mstud.id_no
WHERE (tb_mstud.id_no = 'sk0010')


And this is the error when im verify my systax
"colum 'tb_mstud.lname' is invalid select list because it is not contained in either aggregate function
or the GROUP BY clause"


thanks in advance..

Is This A Good Question/Topic? 0
  • +

Replies To: geting the last data from the database

#2 Kizzle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 07-July 14

Re: geting the last data from the database

Posted 11 July 2014 - 01:40 AM

After
WHERE (tb_mstud.id_no = 'sk0010')


Try add GROUP BY "column name"
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9277
  • View blog
  • Posts: 34,780
  • Joined: 12-June 08

Re: geting the last data from the database

Posted 11 July 2014 - 07:26 AM

Quote

I having problem with my code
im try to pull the last data from my data base

Last relative to what? Is there a date inserted you can sort by? A specific id sequence you can do the same? It's a little rough to know what is going on with those column names.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1