If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > which field shld i use?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-13-06, 05:40
silverxc silverxc is offline
Registered User
 
Join Date: Dec 2004
Posts: 11
Question which field shld i use?

hi guys i have another problem , hope u can give me some pointers.
below is the project i am doing to give it a clearer overview

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
My needed project

A very simple food menu tracking form and statistics form

1) a client-side ASP form page (for waiters) that has e.g 4 checkbox available for them to choose

> pasta
> coke
> pizza
> sides

- they can select 1-4 checkbox and when submit, they will be submitting to a DB

next

2) a server side ASP form to display the selection trend as inserted abv (sort of a statistics page) and retrieve info from the DB

- the stats that i need in that page

1) how many orders for that day (!!! problem here)
2) food selection

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

my problem right now is how to determine which field for the "how many orders for that day"

as my db field is only ( date, selection,waiter name, waiter ID)

hope u guys can give me some pointers
appreciated =)
Reply With Quote
  #2 (permalink)  
Old 11-13-06, 07:45
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
have a look at the followign sub clauases in the SELECT statement

SUM(<mycolumn#1>)
AND
GROUP BY <mycolumn#2>;
usage is
SELECT <mycolumn#1>,SUM(<mycolumn#2>) FROM <mytable> GROUP BY <mycolumn#1>;
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 11-13-06, 07:49
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
might want to consider the COUNT() aggregate function for the "how many orders per day" question
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 11-13-06, 08:32
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
Quote:
Originally Posted by r937
might want to consider the COUNT() aggregate function for the "how many orders per day" question
..good point, but I did think silverxc had to do something to get the answer they are looking for
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #5 (permalink)  
Old 11-14-06, 11:14
silverxc silverxc is offline
Registered User
 
Join Date: Dec 2004
Posts: 11
which field.??

hi guys i think my qn might not be phrased very correctly

wat i need to find out is @ my statistics page , i need to display the no. of orders for a particular day , but however now my tracking is only based on

as my db field is only ( date, selection,waiter name, waiter ID)

and this insert statement can happen 2-3 times but for only one order

1) ONE ORDER but with 2 items
20/11/06 pasta steven 4077
20/11/06 calamari steven 4077

so i need to think of a field to collate the orders. and this is the headache i am facing, hope u guys can give me some pointers.
Reply With Quote
  #6 (permalink)  
Old 11-14-06, 11:50
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
so what have you tried so far, and what about your attempt that isnt working?
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #7 (permalink)  
Old 11-14-06, 20:54
silverxc silverxc is offline
Registered User
 
Join Date: Dec 2004
Posts: 11
Quote:
Originally Posted by healdem
so what have you tried so far, and what about your attempt that isnt working?

yup thats the thing.. i cant figure out which field shld i add on to track the orders.

things i am pondering right now is shld i open another table just to track the field?
Reply With Quote
  #8 (permalink)  
Old 11-14-06, 21:24
silverxc silverxc is offline
Registered User
 
Join Date: Dec 2004
Posts: 11
hi guys i have thgt of an idea but suspect its not very effective in some ways.


wat i can think of is to create another table just to store the orders.
this can solve my problems right now but is there any better ideas u can advise me?

thanks in advance
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On