Skip to content

Tag: sql

PIVOT (without aggregation?) in SQL

I am trying to put together a select statement on some data like the below using TSQL: Table1: Property Detail Record No Surname Smith 1 First Name Anne 1 Title Mrs 1 Gender F 1 Surname Jones 2 First Name Ben 2 Title Mr 2 Gender M 2 Which I am hoping to get results which would appear like this:

Unfold Data by Column

I have a dataset that looks like this (where the codes of ID1 and ID2 can never be the same. So putting them together they are still unique): ID ID1 Name AGE ID2 Primary Secondary 1 1234 Jim 34 1111 Mars A 2 1234 Tom 24 1111 Mars A 3 1234 Rick 55 1112 Mars B 4 2222 Ann 22

How to insert an array value to an existing JSON document?

Given a column containing a JSON document, I can use JSON_SET() to set a key in the JSON document to a value. Supported values are null, true, false, numbers and strings; but I can’t figure out how to set an array. The example in the documentation (for JSON_INSERT(), but it works the same) weirdly shows…

Integrity constraint violation: 1052

Integrity constraint violation: 1052 Column ‘id’ in where clause is ambiguous (SQL: select * from kumeti_member_registrations left join members list on members list.id = kumeti_member registrations.member_name where id = 2)”, this Query please solve the error Answer Try this: