CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 SQL Statement Question

Print topic Send  topic

Author Message
spaceclown
Posted: 02/08/2002, 7:04 AM

This is the statement

select member_id,
iif (sum(quantity*price)>100,100,sum(quantity*price)) as sub_total,
(sub_total+40) as total from items,
orders where orders.item_id=items.item_id
group by member_id

On my form (grid) that I use to view the orders made I see member_id as a number, I want to view the member_id as the Users name. So I need to look at the table called users and the column called user_name. Member_ID in the users table is called user_id (confusing, i know). So basically I guess i need a join but I don't know how to put it in my sql statement. Any ideas, and ideas on a good book that explains sql statements? Thanks again for alll your guys help
Ron Borkent
Posted: 02/11/2002, 5:57 AM

select member_id,user_name,
iif (sum(quantity*price)>100,100,sum(quantity*price)) as sub_total,
(sub_total+40) as total from items,users,
orders where orders.item_id=items.item_id
and ,member_id=user_id
group by member_id

I take it that your user table has several fields like:
user_id
user_name
etc

member_id and user_id should be the same so above I joined them on meber_id and user_id

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.