Jump to content


Photo

Using an alias name in select query


  • Please log in to reply
3 replies to this topic

#1 cyprus

cyprus
  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 24 September 2006 - 11:10 AM

Is it permitted/possible to change a select query statement to create an alias name. I tried below but did not work:

$query = "select Total as runningtotal from orders";

runningtotal being the table field name, Total as I want to be displayed later. Thanks

#2 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 24 September 2006 - 11:28 AM

SELECT total AS runningtotal FROM orders
means when grabbing the data, you grab the fieldname runningtotal NOT total
Tell me the problem, I will try tell you the solution

#3 sasa

sasa
  • Staff Alumni
  • Advanced Member
  • 2,804 posts
  • LocationHrvatska

Posted 24 September 2006 - 11:54 AM

try 'select runningtotal as Total from orders'

#4 cyprus

cyprus
  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 24 September 2006 - 12:04 PM

Thanks sasa, that did it!! Regards - Thanks onlyican for reply.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users