gpt4 book ai didi

java - 多表多列的 SELECT 查询

转载 作者:行者123 更新时间:2023-12-01 07:26:10 25 4
gpt4 key购买 nike

我附上一张我的问题的图片:

enter image description here

  1. 在测试 jFrame jTextField 中,我将插入客户 ID,然后在按“确定”按钮后,查询将选择并收集与该客户相关的信息。然后它将显示在 jTableModel 中。
  2. 我附上我的数据库图像。
  3. 错误是“无法执行 SQL 代码”。

最佳答案

你可以这样做(不加入):

SELECT   papers.paper_list,papers_rate.monday,papers_rate.tuesday,
papers_rate.wednesday,papers_rate.thrsday,papers_rate.friday,
papers_rate.saturday,papers_rate.sunday,magzines.magzine_name,magzines_rate.rate
FROM papers,papers_rate,magzines,magzines_rate
WHERE example_table.customer_id = ? AND other conditions"

This syntax is, in effect, a simple INNER JOIN. Some databases treat it exactly the same as an explicit JOIN. The WHERE clause tells the database which fields to correlate, and it returns results as if the tables listed were combined into a single table based on the provided conditions.(http://www.techrepublic.com/article/sql-basics-query-multiple-tables/)

关于java - 多表多列的 SELECT 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24381243/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com