JSON arrays using FOR JSON PATH SQLHow can I prevent SQL injection in PHP?Add a column with a default value to an existing table in SQL ServerHow do I format a Microsoft JSON date?Can comments be used in JSON?How can I pretty-print JSON in a shell script?Inserting multiple rows in a single SQL query?What is the correct JSON content type?How do I UPDATE from a SELECT in SQL Server?Why does Google prepend while(1); to their JSON responses?What are the options for storing hierarchical data in a relational database?

Multi tool use
Multi tool use

Why am I getting an electric shock from the water in my hot tub?

Which are more efficient in putting out wildfires: planes or helicopters?

What is this fluorinated organic substance?

Existence of infinite set of positive integers s.t sum of reciprocals is rational and set of primes dividing an element is infinite

Trace in the category of propositional statements

GFCI versus circuit breaker

Was Wolfgang Unziker the last Amateur GM?

Merging two data frames into a new one with unique items marked with 1 or 0

Why would Dementors torture a Death Eater if they are loyal to Voldemort?

Are the plates of a battery really charged?

Are all notation equal by derivatives?

Square wave to sawtooth wave using two BJT

What was the ASCII end of medium (EM) character intended to be used for?

Which high-degree derivatives play an essential role?

Is it theoretically possible to hack printer using scanner tray?

How to track mail undetectably?

What does this Pokemon Trainer mean by saying the player is "SHELLOS"?

Is this house-rule removing the increased effect of cantrips at higher character levels balanced?

Variable declaration inside main loop

Can I hire several veteran soldiers to accompany me?

Emphasize numbers in tables

Tricky riddle from sister

What could a Medieval society do with excess animal blood?

How soon after takeoff can you recline your airplane seat?



JSON arrays using FOR JSON PATH SQL


How can I prevent SQL injection in PHP?Add a column with a default value to an existing table in SQL ServerHow do I format a Microsoft JSON date?Can comments be used in JSON?How can I pretty-print JSON in a shell script?Inserting multiple rows in a single SQL query?What is the correct JSON content type?How do I UPDATE from a SELECT in SQL Server?Why does Google prepend while(1); to their JSON responses?What are the options for storing hierarchical data in a relational database?













0















First time using FOR JSON PATH in MSSQL to generate a JSON output as below, HELP! I need to create a JSON output like that from a SQL View, I am having trouble writing the Query using FOR PATH specially for the UNCCID and ViewModels array




"UNCCID": 4,
"viewModels": [

"year": 2019,
"departments":
"IT":
"id": 1,
"name": "Computer Science",
"Teachers": [

"name": "ABC",
"teacher_id": 1,
,

"name": "ZXQ",
"teacher_id": 2,

]



]


My Table looks like this



Table View










share|improve this question
























  • What is your view structure?

    – Zhorov
    Mar 25 at 17:26











  • @Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table

    – Rudy
    Mar 25 at 18:07











  • Please post the structure of all tables involved and how they are linked together.

    – Andrea
    Mar 27 at 10:53















0















First time using FOR JSON PATH in MSSQL to generate a JSON output as below, HELP! I need to create a JSON output like that from a SQL View, I am having trouble writing the Query using FOR PATH specially for the UNCCID and ViewModels array




"UNCCID": 4,
"viewModels": [

"year": 2019,
"departments":
"IT":
"id": 1,
"name": "Computer Science",
"Teachers": [

"name": "ABC",
"teacher_id": 1,
,

"name": "ZXQ",
"teacher_id": 2,

]



]


My Table looks like this



Table View










share|improve this question
























  • What is your view structure?

    – Zhorov
    Mar 25 at 17:26











  • @Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table

    – Rudy
    Mar 25 at 18:07











  • Please post the structure of all tables involved and how they are linked together.

    – Andrea
    Mar 27 at 10:53













0












0








0


1






First time using FOR JSON PATH in MSSQL to generate a JSON output as below, HELP! I need to create a JSON output like that from a SQL View, I am having trouble writing the Query using FOR PATH specially for the UNCCID and ViewModels array




"UNCCID": 4,
"viewModels": [

"year": 2019,
"departments":
"IT":
"id": 1,
"name": "Computer Science",
"Teachers": [

"name": "ABC",
"teacher_id": 1,
,

"name": "ZXQ",
"teacher_id": 2,

]



]


My Table looks like this



Table View










share|improve this question
















First time using FOR JSON PATH in MSSQL to generate a JSON output as below, HELP! I need to create a JSON output like that from a SQL View, I am having trouble writing the Query using FOR PATH specially for the UNCCID and ViewModels array




"UNCCID": 4,
"viewModels": [

"year": 2019,
"departments":
"IT":
"id": 1,
"name": "Computer Science",
"Teachers": [

"name": "ABC",
"teacher_id": 1,
,

"name": "ZXQ",
"teacher_id": 2,

]



]


My Table looks like this



Table View







sql json sql-server






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 18:06







Rudy

















asked Mar 25 at 17:23









RudyRudy

1441 gold badge2 silver badges12 bronze badges




1441 gold badge2 silver badges12 bronze badges












  • What is your view structure?

    – Zhorov
    Mar 25 at 17:26











  • @Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table

    – Rudy
    Mar 25 at 18:07











  • Please post the structure of all tables involved and how they are linked together.

    – Andrea
    Mar 27 at 10:53

















  • What is your view structure?

    – Zhorov
    Mar 25 at 17:26











  • @Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table

    – Rudy
    Mar 25 at 18:07











  • Please post the structure of all tables involved and how they are linked together.

    – Andrea
    Mar 27 at 10:53
















What is your view structure?

– Zhorov
Mar 25 at 17:26





What is your view structure?

– Zhorov
Mar 25 at 17:26













@Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table

– Rudy
Mar 25 at 18:07





@Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table

– Rudy
Mar 25 at 18:07













Please post the structure of all tables involved and how they are linked together.

– Andrea
Mar 27 at 10:53





Please post the structure of all tables involved and how they are linked together.

– Andrea
Mar 27 at 10:53










0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343345%2fjson-arrays-using-for-json-path-sql%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343345%2fjson-arrays-using-for-json-path-sql%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







ak,R,INEZEf47FH3vGcMVhNtaUEDrDNPianRm7D5TzWy7E,PY3KyJNsFva5NBGpvJHY,E,Zk,Zsip4NCXK4U68Pl
fG3C6lMKydEdeRa,6vfe3SybM4wL hqK Z6uijA1plSUwF4RUnamzPZirji0jCS fM3AjP,Cn7X8CbQ,RD P,oo

Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현