kwee12
Posts: 3
|
| Posted: 10/22/2004, 11:59 AM |
|
Hi all, just got two relatively straightforward questions.
The first concerns an sql statement. Say I have two tables, one a list of clients, the other a list of sales (which includes a unique id, along with client id and transaction amount for each sale). How can I show on a list of my clients the total $$ of all sales. If i were to know their id, i would do the mysql command count(*) from salestable where client=clientid, however, in a list, I'm not so sure how to do this. (by list, I mean the table_list.php_ page that ccs generated for me).
Second question is even easier...I have a field, where I want users to select from several options - I tried to create a list box, but have been blind enough that I cant seen where to specify the values for the pulldown box (im using form-> listbox). The field type is text, not enum, but that shouldn't matter.
Much thanks guys
Ken Wee
|
 |
 |
cobom
Posts: 55
|
| Posted: 10/22/2004, 6:58 PM |
|
2nd ?:
If the field contains the options to choose from - choice1, choice2, etc. then changing the label to a list box will allow you to assign a connection, datasource (field), binded value, and displayed value - ie optionID, optionNAME - to the label. You can also click on the ... in the datasource drop down to create more elaborate SQL - sort by, if statements, ors, ands, etc.
I am new to this too, but I like the power to quickly do things like: If this logged on user is in this department, show these drop down choices only - very cool.
hope that helps....
_________________
cmckinney@searay.com
Will program for a Sea Ray 680 SS ;} |
 |
 |
peterr
Posts: 5971
|
| Posted: 10/22/2004, 8:43 PM |
|
Re: 1
In a list/grid you would do this by creating an SQL statement that lists records, with the appropriate calculations, then use that SQL as the Data Source for your Grid.
A little knowledge of SQL may be necessary here, especially the GROUP BY statement. Refer to various SQL tutorials on the net. Here is simple example of GROUP BY with totals (SUM): http://www.w3schools.com/sql/sql_groupby.asp
Re: 2
Look in listbox properties.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
|