Sql Query是:
select T1.SellerId , count(T2.productId)
from
tbl_1 T1
left join
tbl_2 T2
on T1.SellerId = T2.sellerId
where VisitorUserId = 'bf8581b04429fdf56c6ebc'
group by T1.SellerId
我在Linq C#中需要这个SQL查询。
答案 0 :(得分:0)
假设import { Component, Output, EventEmitter } from '@angular/core';
import { Validators } from '@angular/forms';
import { Location } from '@angular/common';
import { ip4Address } from '../validations/patterns';
import { ServersService } from './service';
import { Server } from './model';
@Component({
selector: 'server-add',
template: require('./server-add.component.html'),
providers: [ServersService]
})
export class ServerAddComponent {
servers: Server[];
ip4Address = ip4Address;
model = new Server();
@Output() serverAdded = new EventEmitter();
constructor(
private serversService: ServersService,
private location: Location) {
}
submitForm() {
this.serversService.addServer(this.model)
.subscribe(model => {
model = model
});
}
goBack(): void {
location.reload();
}
}
是VisitorUserId
的列,并且假设您使用ORM之类的Entity Framework以及外键关系的导航属性,那么它应该是这样的:
tbl_1