Page 1 of 1
the query
Posted: Tue Jul 20, 2010 9:55 am
by everydayrun
$result = mysql_query("SELECT area,
agent_name,
item_name,
quantity,
item_price,
(quantity*item_price) as total
FROM agents
INNER JOIN sales on agents.agent_id = sales.agent_id
INNER JOIN items on sales.item_id = items.item_id
ORDER BY area ASC");
what's the query meaning? any tips would be appreciated
Re: the query
Posted: Tue Jul 20, 2010 5:14 pm
by JakeJ
A query is a request for information.
If you're a file clerk and have lots of papers full of information in your file cabinets, I'd walk up to you and tell you...
Hi there. I need some information from the "agents" file. Please give me a report with agent_name, item_name, quantity, item_price, and the quantity x the item_price as total. ALSO, I need you to add in some stuff from the items and sales files. The agent id in sales needs to be the same as agent id in agents. And the item id in items must match the item id in sales. And please sort it by area in ascending order.
Does that make sense? It might be helpful for you to do one of the many mysql tutorials available out there.
Re: the query
Posted: Tue Jul 20, 2010 8:15 pm
by everydayrun
JakeJ wrote:A query is a request for information.
If you're a file clerk and have lots of papers full of information in your file cabinets, I'd walk up to you and tell you...
Hi there. I need some information from the "agents" file. Please give me a report with agent_name, item_name, quantity, item_price, and the quantity x the item_price as total. ALSO, I need you to add in some stuff from the items and sales files. The agent id in sales needs to be the same as agent id in agents. And the item id in items must match the item id in sales. And please sort it by area in ascending order.
Does that make sense? It might be helpful for you to do one of the many mysql tutorials available out there.
GOT it,many thanks.you did a great job.