我有两个与while循环相关的查询。我想在一个查询中进行。以下是我的代码
% root for f(x) = cos(x)
%% Define parameters
paso = 0.5e-10;
N = 100;
x = 1.0;
i = 1;
eps = 1;
root_delta = 4.6;
%% Allocate arrays
it = [];
error_data = [];
%% Generate data
while eps >= paso && i <= N
y = x - (cos(x)/(-sin(x)));
eps = abs(y-x);
x = y;
error_delta(i) = abs(root_delta - x); %#ok<SAGROW>
it(i) = i; %#ok<SAGROW>
i = i + 1;
end
%% Plot data
figure(1);
semilogy(it,error_delta);
xlabel('Iterations');
ylabel('Error \delta');
答案 0 :(得分:0)
您需要JOIN
。
SELECT a.*
FROM faq a
INNER JOIN faq_cat b ON a.fk_faq_cat_id = b.faq_cat_id
WHERE a.faq_status=1 AND b.faq_cat_status=1
这是关于SQL Join的指南。