java - What is the query to display data from 3 tables of mysql to JFrame?
问题描述
My sql query is unable to show data of database tables into JFrame
I connect my database in phpMYAdmin from JFrame .I joined these three tables of database in my query and apply set and get Text in my code.
This is my Query in mysql
SELECT *
FROM agent AS a
INNER JOIN client AS c ON a.Agent_Id=c.Agent_Id
INNER JOIN policy AS p ON c.Policy_No=p.Policy_No
This is my code in Java
while(rs.next())
{
int Agent_Id = rs.getInt("Agent_Id");
Agent_Id1.setText(String.valueOf(Agent_Id));
String F_Name = rs.getString("F_Name");
Agent_Name1.setText(F_Name);
float Salary=rs.getFloat("Salary");
Salary1.setText(String.valueOf(Salary));
float Commission = rs.getFloat("Salary");
Commission1.setText(String.valueOf(Salary*1.1));
int Client_Id= rs.getInt("Client_Id");
Client_Id1.setText(String.valueOf(Client_Id));
int Policy_Id = rs.getInt("Policy_Id");
Policy_Id1.setText(String.valueOf(Policy_Id));
}
Column 'Client_Id' not found.
Column 'Policy_Id' not found.
It only gives the data from agent table. I want to show from all these tables.
解决方案
推荐阅读
- node.js - 是否有在浏览器中运行的 git 客户端?
- android-studio - 吸管工具在 android studio 中不可点击
- css - 如何去除离子输入中有焦点线?
- java - java中的基本数据格式转换
- javascript - 单击“保存”时状态未更新
- python - 如何在`pandas`中合并部分多索引
- go - 致命错误:所有 goroutine 都处于休眠状态 - 死锁!当使用带有 for-select 循环的 WaitGroup 时
- postgresql - Postgresql:禁用特定用户(root)的远程连接?
- c# - C# 错误:CS0103 当前上下文中不存在名称“”
- webstorm - 如果输入来自 WebStorm 中的 Web,如何在控制台中查看输出