---
title: "依条件查询本身记录和第一层子记录"
author: "dywjavaeyw"
date: "2011-04-22T15:02:19Z"
tags: []
categories: ["数据库"]
slug: "untitled"
draft: false
lastmod: "2011-04-22T15:03:14Z"
id: 1012677
url: "https://dywjavaeyw.iteye.com/blog/1012677"
---

第一种方法：

```java

eg:
int a[] = new int[]{1,2};
select * from tepd.functions where functionsid in (a) or topfuncid in (a)

```

第二种：

```java

int b =6;
select * from tepd.functions a where a.functionsid=b union select * from tepd.functions b  where b.topfuncid=b

```