Any SQL Pro's in the room?

shabbaranks

VIP Member
VIP Member
Joined
Jul 14, 2001
Messages
1,781
Reaction score
389
Location
Cornwall
Hi guys,

Im after some SQL knowledge if possible please and the use of pivots - can anyone assist me? Basically Ive got a table which stores data as below
Code:
You don't have permission to view the code content. Log in or register now.

And I cant for the life of me work out how to PIVOT the TraceableItemID so it reads

Code:
You don't have permission to view the code content. Log in or register now.

And so on...
Thanks
 
See if that helps ?

h**ps://www.sqlservertutorial.net/sql-server-basics/sql-server-pivot/


PLUS backup your database first !!!!!!!!!
 
Yeah thanks I just cant get it to sink in relative to my tables and data....
 
You should get an error report on the table if you have tried to make changes as above? on your site

Post the error and see if the guys can help from the error logs

What is your site using php 7?

More info the better
 
Last edited:
Hi
Its not a website its the backend of an application. Will try to use the example to work out where Im going wrong. (I already know where the problem is - me 😜).

Not sure if anyone else gets the same issue, some people can read a process or set of instructions and it sinks in I find things tend to take a bit longer.
 
Right guys I am making progress but probably more luck than judgement....
Below is my current code
SQL:
You don't have permission to view the code content. Log in or register now.

Im getting the column headings and each row only contains 1 STKTraceItemBatchAttribute.TraceableItemID but all the columns within the PIVOT are NULL.

Any ideas?
 
Are there any visual tools available? Something with a GUI?
 
I think I have worked it out. I need to be able to lookup the values in the STKTraceItemBatchAttribute.TraceableItemID and build the PIVOT values from that.
 
Back
Top