Jira Software 7.1.2 - Sprint ID from AO_60DB71_SPRINT does not match the IDs on CustomFieldValue - sql

I'm currently on a project where I need to develop some analysis using the Jira Software database. We have Jira 7.1.2, and it is installed on Oracle.
I did some research and found out that the Sprint ID from the table AO_60DB71_RAPIDVIEW should be found on the table customfieldvalue (field stringvalue) so that I can join issues with sprints.
However, although the IDs I get from customfieldvalue match the ones I get from Jira UI, they do not match the ones on AO_60DB71_RAPIDVIEW (hence making it impossible for me to join issues with sprints for my dashboards).
Does anyone know how can I solve that, please?
Also, I know that the sprint is with different IDs on the two tables because I have its name on both of them (fields Name on AO_60DB71_RAPIDVIEW and NewString on customfieldvalue).
Thanks so much in advance!

Related

Correcting Specific Values in SSIS Package.

I am building a report for one of our departments that counts software licenses by cost center. The problem I have is we have our upper level management that is in a specific cost center for organizational purposes (which the license system grabs) but the department requesting the report needs to have the cost center that the managers expense everything to instead.
this effects about 15 entries but the report pulls over 300, so I only need to correct the 15 without impacting the rest.
I have created a table labeled [dbo].[CostCenter_corrections] with two columns in it [UserID] (nvarchar, this is the user name not an employee ID) and [CostCenter_Correction] (int, this is their expense cost center).
What I want to do is either set up a method at the end of the Staging Load that will correct these numbers by the UserID, like an executeSQL Task, or build another SSIS package that will process the Staging Data and reload it into the same staging table (not sure if that is possible or even something that should be done).
If you can think of any other way I'm open to ideas.
Thank you in advance for any help.
you may need to set the lookup to "Redirect rows to no match output" (you can do this from the genaral tab) and then you will have two outputs from the lookup, one for matched rows and one for not matched. Then you can do the work you need and union the two pipelines back. Your DF will look like this:

Consolidate duplicate clients and sales

I have a question and I can't come up with a good way to solve it, this is using SQLServer 2008R2.
I have 3 tables
Client, Invoice, Car
The client is duplicate n times, but each client has a ticket and one product.
So I am trying to consolidate the clients (with a unique identifier), now my question would be how to update the reference field on the product and ticket.
Example
**Client**
[Nombre]
,[Apellido_Paterno]
,[Apellido_Materno]
,[Sexo]
,[Estado_Civil]
,[Fecha_Nacimiento]
,[RFC]
,[Saludo]
,[Persona]
,[Razon_Social]
,[Direccion]
,[Colonia]
,[Municipio_Delegacion]
,[Estado]
,[Codigo_Postal]
,[Lada_Casa]
,[Telefono_Casa]
,[Ext_Telefono_Casa]
,[Lada_Oficina]
,[Telefono_Oficina]
,[Ext_Telefono_Oficina]
,[Telefono_Celular]
,[Email_Personal]
,[Vehiculo_Actual_Anterior]
,[Marca_Actual_Anterior]
,[AnioModelo_Actual_Anterior]
,[Color_Actual_Anterior]
,[Escolaridad]
,[Venta_Id]
,[Nombre1]
,[Nombre2]
**Invoice**
[Factura_Cliente]
,[Factura_Distribuidor]
,[Precio_Base_Vehiculo]
,[Precio_Accesorios]
,[Precio_Vehiculo_DeContado]
,[Descuento]
,[Incentivo_Calculado]
,[Fecha_Entrega_DelVehiculo]
,[Fecha_Factura_Cliente]
,[Clave_Distribuidor]
,[Seguro_Gratis]
,[Clave_Promocion]
,[Tipo_Venta]
,[Unidad_de_Intercambio]
,[Venta_Id]
**Car**
[Modelo]
,[Marca]
,[AnioModelo]
,[Basico]
,[Cabecera]
,[Version]
,[Color_Exterior]
,[Color_Interior]
,[VIN]
,[Motor]
,[Transmision]
,[Origen]
,[Basico_Linea_Modelo]
,[Venta_Id]
I can consolidate the clients, (even if they have discrepancies on their fields), but I can't find a effective solution for this.
Edit: The first column on client shows the duplicate, while the second is the id that match the ticket and product.
i would make two more tables.
one for new consolidated clients (with all the same fields as the normal client)
and a mapping table between the old client and the new client.
this mapping table should store the id of the old one, and which i it was mapped to as a new one.
from here its pretty easy. update the other tables with the new id based on its current old id in the map table..

sql update multiple rows with multi join subselect

This is an updated part 2 of a question I asked earlier. I'm trying to make the following update, but this query does not actually seem to do anything.
UPDATE u
SET graduation_class_id = gc.graduation_class_id
FROM [user] u
JOIN graduation_class gc
ON u.graduation_class_id = gc.graduation_class_id
JOIN graduation_term gt
ON gt.graduation_year_id = gc.graduation_year_id
TABLE SCHEMA
**user
user_id
graduation_class_id
**graduation_class
graduation_class_id
graduation_year_id
**graduation_term
graduation_term_id
graduation_year_id
The goal is to get the matching graduation_class_id value into the user table. I've been told this won't work because the match won't be found unless the user already has the matching graduation_class_id. That is a problem, because I'm trying to actually get the proper one in there!
This idea is fundamentally doomed to fail. You're trying to get the SQL server to link a graduation class to a user by itself, despite the SQL server not having information on which graduation class should be linked to the user. Unless you have some data somewhere (in user, in graduation_class, in some other table) that links a user_id to the graduation term, class, or year (or someone manually telling SQL which data match up), SQL can't magically do that job for you.

Need Help Writing SQL To Apply Promotions to Shopping Basket at Checkout

Don't laugh but I'm a Lotus Notes (non-relational database!) developer trying to work with SQL and, although I have the basic concepts nailed, I'm stuck on something I'd consider to be "advanced".
Imagine a user reaches an online checkout having added a set of products to their basket. I need to apply promotions to the basket.
These promotions look at the items in the basket and add "points" for any combination that matches a pre-defined "bundle". The promotions also need to be able to target users in specific countries (information gained at point of registration) and other personal details.
The promotions are entered and maintained by the site admin team and need to be as flexible as possible. So they can reward people for things like "Buy X products of type Y and get 50% extra points" or "3 or more XE-123s and get 500 points added" etc.
Right now I'm looking for general direction. How should I store the criteria that matches the items in a basket to any of the running promotions? Would one big Stored Procedure do or should the C# code that builds the basket loop through all promotions and see which fit?
Right now I don't even have a table schema. Just the knowledge of how it should work and little idea where to start.
Jake
My suggestion is to not use SQL for this sort of business logic.
The database is a good place to keep information about products like whether they are type Y or type X. This keeps the database design pretty straightforward.
What you mention about C# seems like a better direction. There is a lot of searchable information about 3-tier architecture that can help explain the benefits of this strategy well.
'As flexible as possible' is a red flag (IMHO). I'd try to nail that down to:
"Fixed-point and/or percentage (of total basket / bundle points) bonus (three columns in a helper table)
When the basket contains a combination that matches a pre-defined 'bundle', where 'bundle' is contained in a helper table, with multiply rows, with a bundleID and a row for each item in the bundle, containing at least ItemID and Quantity.
And no other kinds of reward possible. This to keep the project / requirement manageable.
Then have a SP which checks for the presence of bundles within the basket and applies relevant promotions (as stored in the first helper table).
Also make sure you know the requirement whether 1 or multiple promotions are possible.

TSQL Query for analyzing Text

I have a table that has ordernumber, cancelled date and reason.
Reason field is varchar(255) field and it was written by many different sales rep and really hard to group by the reason category I need to generate a report to categorize cancelation reasons. What is the best way to analyse the reasons with TSQL?
Sample of reasons entered by sales rep
cust already has this order going out
cust can not hold for item Called to cancel order
cust doesn't want to pay for shipping
wife ordered same item from different vendor, sent email
cst made a duplicate order, sent email
cst can't hold
Cust doesn't want to go through verification process so is cancelling order
doesn't ant to hold for Bo
doesn't want
Cust called to cancel the order He can no longer get the product he wants
cnt hld
will not comply with export req
cant' hold
Custs request
Cust will not hold for BO
per. cust. request.
BTW I have SQL Server 2005.
part of your problem is that this these aren't truly reason codes. sounds like an issue with your schema to me. if there aren't predefined reason codes to reference and you're allowing free text entry for each reason, then there's really no way to do this directly, outside of pulling distinct reasons back, which is probably not going to be very useful.
just an idea, can you add another column to the table, even if it's in a temp or test environment and then give the business users the ability to assign a code (e.g. 1 for mis-ships, 2 for duplicate orders, 3 for wrong item etc.) to each order cancellation. then perform the analysis on that.
i assume that's what they're expecting from you, but i don't know that i see any better way. you could always perform the analysis yourself if you have the authority/knowledge but this might be painful if you have a ton of cancellations.
edit- i see now that you've tagged this with regex... it would be possible to setup specified keywords to pull out the entries, but there'd have to be some tolerance built in and still manual analysis afterwards for items which don't fall into any specified category due to misspellings etc. /edit
+1 to #jmatthews, you really need to have reason codes that are selected and then possibly allow free-form entry for the full reason.
If this isn't an option you can look into text clustering. Don't expect that to be fast or easy though, it's still an open research topic and is related to both AI and machine learning.
Look at Term Lookup in SSIS, here is an article to read.