List showing incorrect primary key field
-
I have 2 tables Programs and Campaigns.
Programs:
id int
program char
desc vcharCampaigns
id int
program char
campaign char
date dateforeign key on campaigns.program
See below for exact definition of tables and foreign keys.
When listing the programs table for maint all is well.
When listing the campaigns table for maint, the id of the campaign table is the id from the programs.short codes are:
[abase table="wp_qqxcx8_brc_campaigns" rlink="id"] [abase form="1,update" table="wp_qqxcx8_brc_campaigns" elements="id,program,campaign,dt_start,dt_end,total_mailed,rsp_cnt" fields="id,program,campaign,dt_start,dt_end,total_mailed,rsp_cnt$Update Campaign" ack="brown" style="width:100%;"]
When you select the id (rlink), the following error message is displayed.
#1. [abase table="wp_qqxcx8_brc_campaigns" rlink="id"] Fatal Error (1376) Column 'id' in where clause is ambiguous Check to make sure the upper and lower case spelling of your table and column names are all exactly correct. Valid table names in haag_sfcg: wp_qqxcx8_brc_campaign_details, wp_qqxcx8_brc_campaigns, wp_qqxcx8_brc_programs, wp_qqxcx8_commentmeta, wp_qqxcx8_comments, wp_qqxcx8_links, wp_qqxcx8_options, wp_qqxcx8_postmeta, wp_qqxcx8_posts, wp_qqxcx8_rg_form, wp_qqxcx8_rg_form_meta, wp_qqxcx8_rg_form_view, wp_qqxcx8_rg_lead, wp_qqxcx8_rg_lead_detail, wp_qqxcx8_rg_lead_detail_long, wp_qqxcx8_rg_lead_meta, wp_qqxcx8_rg_lead_notes, wp_qqxcx8_term_relationships, wp_qqxcx8_term_taxonomy, wp_qqxcx8_terms, wp_qqxcx8_usermeta, wp_qqxcx8_users. SELECT * FROM wp_qqxcx8_brc_campaigns LEFT JOIN <code>wp_qqxcx8_brc_programs</code> AS <code>wp_qqxcx8_brc_campaigns$program$wp_qqxcx8_brc_programs</code> ON <code>wp_qqxcx8_brc_campaigns</code>.program=<code>wp_qqxcx8_brc_campaigns$program$wp_qqxcx8_brc_programs</code>.program WHERE <code>id</code>='1' table_error = '' cols_in = '' fields_in = '' columns_in = '*' form = ''
here is the sql for the table and constraints:
CREATE TABLE IF NOT EXISTS
wp_qqxcx8_brc_campaigns` (
id
int(11) NOT NULL AUTO_INCREMENT,
program
char(8) NOT NULL,
campaign
char(12) NOT NULL,
dt_start
date DEFAULT NULL,
dt_end
date DEFAULT NULL,
total_mailed
int(11) NOT NULL DEFAULT ‘0’,
rsp_cnt
int(11) NOT NULL DEFAULT ‘0’,
created
datetime DEFAULT NULL,
modified
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id
),
UNIQUE KEYpgm_campaign
(program
,campaign
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=’brc campaigns’ AUTO_INCREMENT=23 ;—
— Constraints for tablewp_qqxcx8_brc_campaigns
—
ALTER TABLEwp_qqxcx8_brc_campaigns
ADD CONSTRAINTwp_qqxcx8_brc_campaigns_ibfk_1
FOREIGN KEY (program
) REFERENCESwp_qqxcx8_brc_programs
(program
) ON DELETE CASCADE ON UPDATE CASCADE;`Am I entering the shortcodes incorrectly, missing a parm or is there a bug?
- The topic ‘List showing incorrect primary key field’ is closed to new replies.