• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

SQL Question - Identifying unique rows based on criteria

CellarDoor

Golden Member
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.
 
Back
Top