Jump to content

jonnytekno

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About jonnytekno

  • Rank
    Newbie
  1. jonnytekno

    Force data into unique row format

    I have marketing campaign some data where there is a unique campaign id and then a campaign name. But, there can sometimes be more than one campaign name for a single campaign id - this means joining the campaign name to other data where the campaign id exists is hard. I want to be able to force the data into a table where the campaignid and campaign name are always unique, which means I need to drop one of the campaign names, but don't care which (they are practically identical apart from typos etc) How can I do a select id, name from [table] group by id, name where I know that the id is never going to be duplicated?
  2. Hi there - I am not massively proficient at SQL so get stuck with a few things My source data contains orders (hotel bookings actually): each row has a date, value of the booking, and some other attributes e.g. channel booked through, which hotel it was etc I want to create a table where the first column is the date (or actually the month but I can do that easily) but then it has 3 columns, each of which sums the revenue/booking value BUT in each column the selection criteria is different. For example, in column a) I only want to show the revenue for direct bookings; in column b) I want to show the revenue for travel agent bookings; in column c) I want to show all the revenue. I found a few other things about this where people were suggesting using CASE statements, but that only seems to work for counting unless I have missed something Any help much appreciated
×