Alternating Tables - reporting-services

I have three tables and each table has its own dataset:
Table A - Dataset A
Table B - Dataset B
Table C - Dataset C
When running the report I get this:
Table A
Table A
Table A
...
Table B
Table B
Table B
...
Table C
Table C
Table C
...
First all the Data of table A is displayed, then table B, then table C. What I want to achieve is that the tables are alternating. It should look like this:
Table A
Table B
Table C
Table A
Table B
Table C
...
Unfortunatly it is not possible to join these three tables via SQL and I want to avoid to use the lookupset-expression, because then all the data would be displayed in one single cell and not in rows and that looks badly. Or is there a way to generate an new row via expression, similar to Environment.NewLine?

I think the best would be to use subreports for the other 2 tables. I assume there some sort of way to associate the planets to the moons that would be used for the parameters. Then add extra add extra Row in Group for the Moon subreport.
The solution proposed by Hannover First works fine. Working with Sub-Reports solves my problem.
Thanks.

Related

Refresh MySQL table after updation

I have three tables A, B, C. I have a entity D which is a resultant of these three tables obtained using inner joins on various attributes. Now, I got a row updated in table A and a new row got added in table B. How can this be managed, so that my table D gets updated automatically? Each of these tables consists of 100 000 records.

how to separate 1 table into 2 tables and add a new column?

i have 1 table with i want to separate it into 2 tables and i want to add a new column to the new table. how can i do that?
example :
I have table A with column : a, b, c
and i want to copy the data into new table ( Table B and C )
table B with column : a, e,
table C with column : b, c, f
example table
I've tried
CREATE TABLE C as SELECT A.b, A.c FROM A;
but i dont know how to add the new column (c and f). and if i already have hundreds of data what is the best way to input data into these new columns? should i do it one by one? im new to programing and sql, thank you for helping me.
to add new column, you need to use ALTER.
ALTER TABLE table_name
ADD column_name datatype;
Source: W3Schools also it will be a good idea to read the entire thing for mysql. you will learn a lot
but as a warning. make sure you understand what you are doing, the column can be removed later on. but making mistakes can damage your data.
if you need to alter your tables for a specific task only then I suggest creating temporary tables that you can then do whatever you need with. and then discarding them

Getting data from joined tables Ruby

In summary, I need to grab columns from three tables, which all are associated with each other through inbetween tables.
There are four cases with the data:
1. Has data in table A, has data in table B, has data in table C
2. Has data in table A, has data in table B, does not have data in table C
3. Has data in table A, does not have data in table B, has data in table C
4. Has data in table A, does not have in table B, does not have in table C
Is there a single active record query I can use to get the data for all these cases? I cannot use join because the query dies if it come across a row missing any of the pieces. I have tried .includes and .eager_load, but then it does not include the columns from table B or C.
Thank you for your help.

I want to concatenate two tables. Table A(a, b, c), Table B(d) should become Table A (a,b,c, d)

I want to append a table with another table. Table A(a, b, c), Table B(d) should become Table A(a,b,c, d). Assume both tables have same number of records.
I do not think there is any way to do this. Also, this is not logical. What you can do is do a join between the tables. A join is necessarily a Cross product between table A and table B. Read more about joins.

Automatic Update for database rows based on changes in another table

I have a scenario that requires a value in a row of a table to be updated automatically whenever a row has been added or deleted in another table. I'm not sure how to do it.BTW I'm using phpmyadmin in order to manage my database. Thanks in advance.
pages Table
------------
page_no
no_of_choices
choices Table
-------------
page_no
choice_no
When I add a choice with choice number 1 and page_no, then the table page which has the row, page_no=1 should be updated with no_of_choices=no_of_choices+1
You can use triggers.
For example:
CREATE TRIGGER `test1`
AFTER INSERT ON `tbl1`
FOR EACH ROW SET NEW.upd_fld = new_value
Similarly could be done for delete.
You can also create triggers from phpMyAdmin
TABLE A: page_no, no_of_choices
TABLE B: page_no, choice_no...
With a relational database you very rarely want to have duplicate data. If something breaks at some point, you won't know which to trust - the rows in Table B, or the no_of_choices in Table A. A better solution is to do one of the following (depending on which table you are querying):
SELECT COUNT(no_of_choices) FROM B WHERE page_no = 1
or
SELECT A.*, COUNT(choice_no) AS choice_no FROM A LEFT JOIN B USING(page_no)
You get the same result, but now you have one record to go off of, so you won't have inconsistent data.