多个查询 [英] multiple querries

查看:50
本文介绍了多个查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要进行多个查询,第二个和第三个依赖于从第一个查询中检索的数据。第一个在表中查找用户。如果用户在那里,那么我们继续。但是,如果它们不存在,那么我的所有其他查询都会失败,因为缺少信息。如果不在db中,我需要优雅地停止顺序查询。我在内部工作,无法提供链接,但我的代码如下。


提前致谢。

展开 | 选择 | Wrap | 行号

解决方案

您好。


为此,您可以在尝试之前检查确实有任何数据可用在第二个查询中使用它,使用 if构造


例如:

展开 | 选择 | Wrap | 行号


我接受了你的建议但是当它试图在没有记录发现之前打印出字段时似乎错了。


错误只是说解析错误没有详细信息。

展开 | 选择 | 换行 | 行号


< blockquote>它必须给你一些细节,比如行号和文件名?

究竟是什么意思?


然而,问题似乎是是你在那里只有else子句。我看不到if条款。你是不是意外删除了它?


I need to make multiple queries and the second and third rely on data retrieved from the first one. The 1st one finds a user in a table. If the user is there then we go on. However if they are not there all my other queries are failing because information is missing. I need to gracefully stop the sequential queries if the are not in the db. I am working internally and cant give a link but my code is below.

Thanks in advance.

Expand|Select|Wrap|Line Numbers

解决方案

Hi.

To do that, you would check that there actually is any data available before you try to use it in the second query, using the the if construct.

For example:

Expand|Select|Wrap|Line Numbers


I took your advice but it seems to be erroring out when it tries to print out the fields just before the "no record found out put"

the error just says parse error no details.

Expand|Select|Wrap|Line Numbers


It must give you some details, like the line number and file name?
What exactly does it say?

The problem, however, seems to be that you only have the else clause there. I can''t see the if clause it goes with. Did you accidentally delete it or something?


这篇关于多个查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆