Jump to content

WoodleySaint

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About WoodleySaint

  • Rank
    Newbie
  1. Hi, Here is a subset of some rows from a SQL table: I would like to construct a select statement which will have a row for each record it finds where the CreditType is 0 and then sum records where the ParentFeeFee is the same as the FeeRef. So the orange ones would form one summation and the green another and the results would be: The easy part is: Select FeeRef from tableName where CreditType = 0 How would I perform the summation part? Many thanks for any guidance.
  2. I would like to add some rows to an existing table in MS SQL server 2005 which has 3 columns: ProviderCodeRef (PK, int, not null) ManagerRef (int, not null) UnitPriceRef (int, not null) The current last row is as follows: ProviderCodeRef ManagerRef UnitPriceRef 164000790 164000598 164000891 If I run the following the record will be added. Insert into ProviderCodes (ProviderCodeRef,ManagerRef,UnitPriceRef) values ('164000791','164000110','164005000'); so the last 2 rows are now ProviderCodeRef ManagerRef UnitPriceRef 164000790
  3. WoodleySaint

    Group by help

    Hi, I'm quite new to SQL so still learning efficient ways to do things. I've constructed the following SQL which returns the results I want but I can't help think there has to be a more efficient way of achieving the desired results. I had to add the 'Sum(cpay.AmountToPay) as 'Payaways'' line which caused multiple errors until I added the Group by for all the fields I wanted to select. Up to that point I didn't need to reference the CommisionPayaways table, which may have multiple records for a give CommnEntries row. Could anyone educatee me as to how I could add the sum() witout all t
×
×
  • Create New...