对不起,如果问题措辞怪异.
我正在写一份报告,我有一张表有这样的字段....
applicationID statusid statuscreationdate
123 1 3-18-2013
123 2 3-27-2013
124 1 3-29-2013
125 1 4-1-2013
125 2 4-3-2013
Run Code Online (Sandbox Code Playgroud)
我只想返回statusid为1的行但是我还要检查每个applicationid是否存在statusid为2.因此,上表中的所需查询将产生:
123 3-18-2013
125 4-1-2013
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激.如果需要更多信息,请告诉我.我希望尽可能简短,简洁,同时包含必要的信息量.
谢谢你的时间.
编辑:更正了所需的结果部分
我是golang的新手,我正在尝试创建一个函数,该函数基于使用的结构,将使用Sprintf返回格式化的字符串
type Name struct {
Title string
First string
Last string
}
type Location struct {
Street string
City string
State string
Zip string
}
func Merge(m interface{}) string {
switch m.(type) {
case *Location:
return fmt.Sprintf("%s \n %s, %s %s", m.(*Location).Street, m.(*Location).City, m.(*Location).State, m.(*Location).Zip)
case *Name:
return fmt.Sprintf("%s. %s %s", m.(*Name).Title, m.(*Name).First, m.(*Name).Last)
}
return "Not Applicable"
}
fmt.Println(Merge(Location))
Run Code Online (Sandbox Code Playgroud)
我正在Not Applicable从我的邮件中得到“ ”信息PrintLn。在该代码的一个版本中,我认为消息是“ out of index”。
StackOverflow的新手,C的新手.我试图将一个struct作为函数'add_fields'中的一个参数,它将前两个int字段'a'和'b'相加,并将结果放在int字段'c'中.没有得到编译器的任何东西,所以很明显我做错了.我只是不知道是什么.任何帮助,将不胜感激.
#include <stdio.h>
struct add{
int a;
int b;
int c;
}
void add_fields(struct add *d){
d->c = a + b;
}
main(){
struct add data;
data.a = 1;
data.b = 2;
data.c = 0;
add_fields(data);
printf("%d + %d = %d", data.a, data.b, data.c);
}
Run Code Online (Sandbox Code Playgroud)