Estas en el tema de como relacionar dos tablas en mysql en el foro de. Tienes un link que dice vista de relaciones, alli solo tienes que crear la relacion que.
I am trying to create a view for the following query. SELECT DISTINCT products.pid AS id, products.pname AS name, products.p_desc AS description, products.p_loc AS location, products.p_uid AS userid, products.isaproduct AS whatisit FROM products UNION SELECT DISTINCT services.s_id AS id, services.s_name AS name, services.s_desc AS description, services.s_uid AS userid, services.s_location AS location, services.isaservice AS whatisit FROM services But not able to do so. I am using MySql query browser.
The error I am getting is: A view can only be created from an active resultset of SELECT command Can someone please help me with this? You might want to swith the order of userid and location in the second select. The column names should match 1 to 1 in all selects of the union. EDIT: For query browser, as points out 'To create a view from a query, you must have executed the query successfully. Edwin louis cole quotes. To be more precise, the view is created from the latest successfully executed query, not necessarily from the query currently in the Query Area' so you need to execute the query first before you create the view in query browser.
The error is from the query browser and not mysql. The error message is in 'QueryBrowser.pas', part of. Procedure TQueryBrowserForm.SQLCreateViewClick(Sender: TObject); //. Begin if Assigned(ActiveResultset) and (ActiveResultset.ResultSet.query.query_type = MYX_QT_SELECT)then //.
Else ShowError('Creation error', _('A view can only be created from a active resultset of SELECT command.' ), []); end; It is triggered by a) not having an active result set and b) the query having the wrong type. Does removing the 'DISTINCT' make any difference? In any case, this is a bug in QueryBrowser, rather than one MySQL. Creating the view directly in MySQL should suffice as a work-around.
Estas en el tema de como relacionar dos tablas en mysql en el foro de. Tienes un link que dice vista de relaciones, alli solo tienes que crear la relacion que.
I am trying to create a view for the following query. SELECT DISTINCT products.pid AS id, products.pname AS name, products.p_desc AS description, products.p_loc AS location, products.p_uid AS userid, products.isaproduct AS whatisit FROM products UNION SELECT DISTINCT services.s_id AS id, services.s_name AS name, services.s_desc AS description, services.s_uid AS userid, services.s_location AS location, services.isaservice AS whatisit FROM services But not able to do so. I am using MySql query browser.
The error I am getting is: A view can only be created from an active resultset of SELECT command Can someone please help me with this? You might want to swith the order of userid and location in the second select. The column names should match 1 to 1 in all selects of the union. EDIT: For query browser, as points out 'To create a view from a query, you must have executed the query successfully. Edwin louis cole quotes. To be more precise, the view is created from the latest successfully executed query, not necessarily from the query currently in the Query Area' so you need to execute the query first before you create the view in query browser.
The error is from the query browser and not mysql. The error message is in 'QueryBrowser.pas', part of. Procedure TQueryBrowserForm.SQLCreateViewClick(Sender: TObject); //. Begin if Assigned(ActiveResultset) and (ActiveResultset.ResultSet.query.query_type = MYX_QT_SELECT)then //.
Else ShowError('Creation error', _('A view can only be created from a active resultset of SELECT command.' ), []); end; It is triggered by a) not having an active result set and b) the query having the wrong type. Does removing the 'DISTINCT' make any difference? In any case, this is a bug in QueryBrowser, rather than one MySQL. Creating the view directly in MySQL should suffice as a work-around.