473,396 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to create a dynamic table

201 100+
Hello -

I'm trying to create a dynamic results table layout from 4 tables.

I want to have the data from the 2 tables asstatusupdate and asstatusdata even if the other two tables do not have a matching record.

I also want to group the tables results for asstatusupdate and asstatusdata i've tried this in sql but did not get the results that i need.

i need to have it retrive one record for asstatusupdate and asstatusdata and many records for asmanystatusupdate and ascomments. grouping by asstatusupdate.

Thanks in advance for your help!

here is the query:

Expand|Select|Wrap|Line Numbers
  1. SELECT a.Id, a.Type, 
  2. a.Dates, 
  3. a.UIdFk, 
  4. b.Id as Did, 
  5. b.comment, 
  6. b.dates as Day, 
  7. b.sfk as Sfk ,
  8. c.sfk as sfk1, 
  9. d.Memo as Memo
  10. FROM 
  11. asstatusupdate as a,  
  12. left join asstatusdata as b 
  13. on a.Id=b.sfk 
  14. left join asmanystatusupdate as c 
  15. on b.sfk=c.sfk
  16. left join ascomments as d 
  17. on c.cfk=d.id
  18. where a.uidfk='1'
  19.  
Apr 20 '11 #1
5 2217
dlite922
1,584 Expert 1GB
"create dynamic table" ? 4 tables?

You gave 2, where's the other two.

I think you're going about your logic wrong.

Tell us your data and what you need from it, i.e. explain the query with plain English language (The business requirement).

Dan
Apr 22 '11 #2
wizardry
201 100+
i need to get the status, and group the comments for each status.

here are the four tables:
asstatusupdate is the catagory
asstatusdata is the data
asmanystatusupdate is the many table
ascomments is the comments table

for example:
status 0
comment 1
comment 2
status 1
comment 3
comment 4

Expand|Select|Wrap|Line Numbers
  1. mysql> desc asstatusupdate;
  2. +-------+---------------------+------+-----+---------+-------+
  3. | Field | Type                | Null | Key | Default | Extra |
  4. +-------+---------------------+------+-----+---------+-------+
  5. | Id    | bigint(20) unsigned | NO   |     | 0       |       |
  6. | Type  | longblob            | NO   |     | NULL    |       |
  7. | Dates | datetime            | NO   |     | NULL    |       |
  8. | UIdFk | bigint(20) unsigned | NO   |     | NULL    |       |
  9. +-------+---------------------+------+-----+---------+-------+
  10. 4 rows in set (0.08 sec)
  11.  
  12. mysql> desc asstatusdata;
  13. +---------+---------------------+------+-----+---------+-------+
  14. | Field   | Type                | Null | Key | Default | Extra |
  15. +---------+---------------------+------+-----+---------+-------+
  16. | Id      | bigint(20)          | NO   |     | 0       |       |
  17. | Comment | longblob            | NO   |     | NULL    |       |
  18. | Dates   | datetime            | NO   |     | NULL    |       |
  19. | SFk     | bigint(20) unsigned | NO   |     | NULL    |       |
  20. +---------+---------------------+------+-----+---------+-------+
  21. 4 rows in set (0.09 sec)
  22.  
  23. mysql> desc asmanystatusupdate;
  24. +--------+---------------------+------+-----+---------+-------+
  25. | Field  | Type                | Null | Key | Default | Extra |
  26. +--------+---------------------+------+-----+---------+-------+
  27. | Id     | bigint(20) unsigned | NO   |     | 0       |       |
  28. | SFk    | bigint(20) unsigned | NO   |     | NULL    |       |
  29. | CFk    | bigint(20) unsigned | NO   |     | NULL    |       |
  30. | CFk0   | bigint(20) unsigned | NO   |     | NULL    |       |
  31. | UIdFk0 | bigint(20) unsigned | NO   |     | NULL    |       |
  32. | UIdFk1 | bigint(20) unsigned | NO   |     | NULL    |       |
  33. | Dates  | datetime            | NO   |     | NULL    |       |
  34. +--------+---------------------+------+-----+---------+-------+
  35. 7 rows in set (0.07 sec)
  36.  
  37. mysql> desc ascomments;
  38. +-------+---------------------+------+-----+---------+-------+
  39. | Field | Type                | Null | Key | Default | Extra |
  40. +-------+---------------------+------+-----+---------+-------+
  41. | Id    | bigint(20) unsigned | NO   |     | 0       |       |
  42. | Memo  | longblob            | NO   |     | NULL    |       |
  43. | Date  | datetime            | NO   |     | NULL    |       |
  44. +-------+---------------------+------+-----+---------+-------+
  45. 3 rows in set (0.11 sec)
  46.  
  47. mysql> 
  48.  
Apr 22 '11 #3
Rabbit
12,516 Expert Mod 8TB
Can you provide some sample data and results you expect from said data?
Apr 22 '11 #4
wizardry
201 100+
here is the results from the query that is posted.

my ultimate goal is to have many types/comments with many memos.

here is the link for the results report:
http://www.only1wizard.com/billboardsquery.pdf
Apr 22 '11 #5
Rabbit
12,516 Expert Mod 8TB
I was looking more for a sampling of the source data and the results you would he looking for from the query.
Apr 23 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ex-Em-El | last post by:
let say i have this xml file : xml: <?xml version="1.0" standalone="yes"?> <aaa> <ppp> <po> <co>c</co> <do>int</do>
7
by: Cindy | last post by:
"kaeli" <infinite.possibilities@NOSPAMatt.net> wrote in message news:MPG.197482677bbc284b989702@nntp.lucent.com... > In article <bed8e3$m6r$1@mawar.singnet.com.sg>, stayhardsg@yahoo.com.sg >...
3
by: RSB | last post by:
Hi Every one Having tuff time creating web controls Dynamically. All i am trying to do is read a table and generate a list of ASP TEXT Box. So how do i create this Control dynamically and where...
1
by: hipek | last post by:
Hi all, I programming in VS2005 C++ .NET 2.0. I dont' know how to create dynamic table. I think do something like that: int size=0; cin >size; char *table = new char;
0
by: Dhanasekaran B | last post by:
Dear I need to create dynamic temproray table for reporting purpose.I did't have permission for DDL commands. Without Database Administrator permission, i need to create temp. Dynamic table. (or)...
1
by: shyamg | last post by:
how to create a dynamic table in jsp. This is i hava some text fields that text field data will be add in the table same jsp . in that page table can .add.update delete buttons i want. any...
6
by: arthyarthy | last post by:
HI ALL I want create Dynamic table from database. Its have 100 box but 10 Rows 10 x 10 Iam using dream weaver CS3. I cant do it in asp . any one help me. thanks in advance my code is follow ...
4
by: Michael Munch | last post by:
Hi I want to read the value of af text-field, create dynamic, in a form. Se below a small test-site to do that (but readning fails): I use the function Test_Read for reading the value from the...
8
by: remya1000 | last post by:
i'm using VB \ ASP.NET. i'm trying to display some values in Gridview. but i don't know how many columns i need to display. at run time only i will come to know how many columns i need to...
1
by: Arielle | last post by:
Problem: I have a few related tables that collects information about a given publication. The information collected varies based on the type of collection and is stored in a few different tables. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.