- Aug 31, 2004
- 1,574
- 0
- 0
All,
I have a fairly basic knowledge of SQL so forgive me if I butcher some terminology. Note that this is not a homework problem but something I'm working on for work.
I pull data into excel using SQL. Up until now, I've performed excel calculations on the table using adjacent columns. I've learned a little more about SQL and have done most of the calculations in the query instead producing faster results. Here's my issue.
Suppose my data consists of the following columns:
Name, Project, Account, Org, Pay Type, Amount.
I would like to create a calculated column that identifies the first time a unique combination of Name, Project, Account, Org and Pay Type occurs.
So, for example, I'd like my result to look something like this:
Name Project Account Org Pay Type Amount Unique
Mike 04C5 50 99 R 25 1
Mike 04C5 50 99 R 40
Jake 04C5 50 99 R 30 2
apologies on the formatting of the above table. The idea is that the second row isn't a unique record based on my criteria whereas the third is, because it is the first record for "Jake."
Does this make sense? Is it possible? I only have the rights to select data.
If someone could point me in the right direction that would be great. Let me know if more information is required. Thank you.
I have a fairly basic knowledge of SQL so forgive me if I butcher some terminology. Note that this is not a homework problem but something I'm working on for work.
I pull data into excel using SQL. Up until now, I've performed excel calculations on the table using adjacent columns. I've learned a little more about SQL and have done most of the calculations in the query instead producing faster results. Here's my issue.
Suppose my data consists of the following columns:
Name, Project, Account, Org, Pay Type, Amount.
I would like to create a calculated column that identifies the first time a unique combination of Name, Project, Account, Org and Pay Type occurs.
So, for example, I'd like my result to look something like this:
Name Project Account Org Pay Type Amount Unique
Mike 04C5 50 99 R 25 1
Mike 04C5 50 99 R 40
Jake 04C5 50 99 R 30 2
apologies on the formatting of the above table. The idea is that the second row isn't a unique record based on my criteria whereas the third is, because it is the first record for "Jake."
Does this make sense? Is it possible? I only have the rights to select data.
If someone could point me in the right direction that would be great. Let me know if more information is required. Thank you.
