Search Results

Search found 24890 results on 996 pages for 'pivot table'.

Page 7/996 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • TSQL - How to join 1..* from multiple tables in one resultset?

    - by ElHaix
    A location table record has two address id's - mailing and business addressID that refer to an address table. Thus, the address table will contain up to two records for a given addressID. Given a location ID, I need an sproc to return all tbl_Location fields, and all tbl_Address fields in one resultset: LocationID INT, ClientID INT, LocationName NVARCHAR(50), LocationDescription NVARCHAR(50), MailingAddressID INT, BillingAddressID INT, MAddress1 NVARCHAR(255), MAddress2 NVARCHAR(255), MCity NVARCHAR(50), MState NVARCHAR(50), MZip NVARCHAR(10), MCountry CHAR(3), BAddress1 NVARCHAR(255), BAddress2 NVARCHAR(255), BCity NVARCHAR(50), BState NVARCHAR(50), BZip NVARCHAR(10), BCountry CHAR(3) I've started by creating a temp table with the required fields, but am a bit stuck on how to accomplish this. I could do sub-selects for each of the required address fields, but seems a bit messy. I've already got a table-valued-function that accepts an address ID, and returns all fields for that ID, but not sure how to integrate it into my required result. Off hand, it looks like 3 selects to create this table - 1: Location, 2: Mailing address, 3: Billing address. What I'd like to do is just create a view and use that. Any assistance would be helpful. Thanks.

    Read the article

  • "select * into table" Will it work for inserting data into existing table

    - by Shantanu Gupta
    I am trying to insert data from one of my existing table into another existing table. Is it possible to insert data into any existing table using select * into query. I think it can be done using union but in that case i need to record all data of my existing table into temporary table, then drop that table and finally than apply union to insert all records into same table eg. select * into #tblExisting from tblExisting drop table tblExisting select * into tblExisting from #tblExisting union tblActualData Here tblExisting is the table where I actually want to store all data tblActualData is the table from where data is to be appended to tblExisting. Is it right method. Do we have some other alternative ?

    Read the article

  • MySQL ALTER TABLE on very large table - is it safe to run it?

    - by Timothy Mifsud
    I have a MySQL database with one particular MyISAM table of above 4 million rows. I update this table about once a week with about 2000 new rows. After updating, I then perform the following statement: ALTER TABLE x ORDER BY PK DESC i.e. I order the table in question by the primary key field in descending order. This has not given me any problems on my development machine (Windows with 3GB memory), but, even though 3 times I have tried it successfully on the production Linux server (with 512MB RAM - and achieving the resulted sorted table in about 6 minutes each time), the last time I tried it I had to stop the query after about 30 minutes and rebuild the database from a backup. I have started to wonder whether a 512MB server can cope with that statement (on such a large table) as I have read that a temporary table is created to perform the ALTER TABLE command?! And, if it can be safely run, what should be the expected time for the alteration of the table? Thanks in advance, Tim

    Read the article

  • How to obtain a random sub-datatable from another data table

    - by developerit
    Introduction In this article, I’ll show how to get a random subset of data from a DataTable. This is useful when you already have queries that are filtered correctly but returns all the rows. Analysis I came across this situation when I wanted to display a random tag cloud. I already had the query to get the keywords ordered by number of clicks and I wanted to created a tag cloud. Tags that are the most popular should have more chance to get picked and should be displayed larger than less popular ones. Implementation In this code snippet, there is everything you need. ' Min size, in pixel for the tag Private Const MIN_FONT_SIZE As Integer = 9 ' Max size, in pixel for the tag Private Const MAX_FONT_SIZE As Integer = 14 ' Basic function that retreives Tags from a DataBase Public Shared Function GetTags() As MediasTagsDataTable ' Simple call to the TableAdapter, to get the Tags ordered by number of clicks Dim dt As MediasTagsDataTable = taMediasTags.GetDataValide ' If the query returned no result, return an empty DataTable If dt Is Nothing OrElse dt.Rows.Count < 1 Then Return New MediasTagsDataTable End If ' Set the font-size of the group of data ' We are dividing our results into sub set, according to their number of clicks ' Example: 10 results -> [0,2] will get font size 9, [3,5] will get font size 10, [6,8] wil get 11, ... ' This is the number of elements in one group Dim groupLenth As Integer = CType(Math.Floor(dt.Rows.Count / (MAX_FONT_SIZE - MIN_FONT_SIZE)), Integer) ' Counter of elements in the same group Dim counter As Integer = 0 ' Counter of groups Dim groupCounter As Integer = 0 ' Loop througt the list For Each row As MediasTagsRow In dt ' Set the font-size in a custom column row.c_FontSize = MIN_FONT_SIZE + groupCounter ' Increment the counter counter += 1 ' If the group counter is less than the counter If groupLenth <= counter Then ' Start a new group counter = 0 groupCounter += 1 End If Next ' Return the new DataTable with font-size Return dt End Function ' Function that generate the random sub set Public Shared Function GetRandomSampleTags(ByVal KeyCount As Integer) As MediasTagsDataTable ' Get the data Dim dt As MediasTagsDataTable = GetTags() ' Create a new DataTable that will contains the random set Dim rep As MediasTagsDataTable = New MediasTagsDataTable ' Count the number of row in the new DataTable Dim count As Integer = 0 ' Random number generator Dim rand As New Random() While count < KeyCount Randomize() ' Pick a random row Dim r As Integer = rand.Next(0, dt.Rows.Count - 1) Dim tmpRow As MediasTagsRow = dt(r) ' Import it into the new DataTable rep.ImportRow(tmpRow) ' Remove it from the old one, to be sure not to pick it again dt.Rows.RemoveAt(r) ' Increment the counter count += 1 End While ' Return the new sub set Return rep End Function Pro’s This method is good because it doesn’t require much work to get it work fast. It is a good concept when you are working with small tables, let says less than 100 records. Con’s If you have more than 100 records, out of memory exception may occur since we are coping and duplicating rows. I would consider using a stored procedure instead.

    Read the article

  • Pass table as parameter to SQLCLR TV-UDF

    - by Skeolan
    We have a third-party DLL that can operate on a DataTable of source information and generate some useful values, and we're trying to hook it up through SQLCLR to be callable as a table-valued UDF in SQL Server 2008. Taking the concept here one step further, I would like to program a CLR Table-Valued Function that operates on a table of source data from the DB. I'm pretty sure I understand what needs to happen on the T-SQL side of things; but, what should the method signature look like in the .NET (C#) code? What would be the parameter datatype for "table data from SQL Server?" e.g. /* Setup */ CREATE TYPE InTableType AS TABLE (LocationName VARCHAR(50), Lat FLOAT, Lon FLOAT) GO CREATE TYPE OutTableType AS TABLE (LocationName VARCHAR(50), NeighborName VARCHAR(50), Distance FLOAT) GO CREATE ASSEMBLY myCLRAssembly FROM 'D:\assemblies\myCLR_UDFs.dll' WITH PERMISSION_SET = EXTERNAL_ACCESS GO CREATE FUNCTION GetDistances(@locations InTableType) RETURNS OutTableType AS EXTERNAL NAME myCLRAssembly.GeoDistance.SQLCLRInitMethod GO /* Execution */ DECLARE @myTable InTableType INSERT INTO @myTable(LocationName, Lat, Lon) VALUES('aaa', -50.0, -20.0) INSERT INTO @myTable(LocationName, Lat, Lon) VALUES('bbb', -20.0, -50.0) SELECT * FROM @myTable DECLARE @myResult OutTableType INSERT INTO @myResult MyCLRTVFunction @myTable --returns a table result calculated using the input The lat/lon - distance thing is a silly example that should of course be better handled entirely in SQL; but I hope it illustrates the general intent of table-in - table-out through a table-valued UDF tied to a SQLCLR assembly. I am not certain this is possible; what would the SQLCLRInitMethod method signature look like in the C#? public class GeoDistance { [SqlFunction(FillRowMethodName = "FillRow")] public static IEnumerable SQLCLRInitMethod(<appropriateType> myInputData) { //... } public static void FillRow(...) { //... } } If it's not possible, I know I can use a "context connection=true" SQL connection within the C# code to have the CLR component query for the necessary data given the relevant keys; but that's sensitive to changes in the DB schema. So I hope to just have SQL bundle up all the source data and pass it to the function. Bonus question - assuming this works at all, would it also work with more than one input table?

    Read the article

  • sql charateristic function for avg dates

    - by holden
    I have a query which I use to grab specific dates and a price for the date, but now I'd like to use something similar to grab the avg prices for particular days of the week. Here's my current query which works for specific dates to pull from a table called availables: SELECT rooms.name, rooms.roomtype, rooms.id, max(availables.updated_at), MAX(IF(to_days(availables.bookdate) - to_days('2009-12-10') = 0, (availables.price*0.66795805223432), '')) AS day1, MAX(IF(to_days(availables.bookdate) - to_days('2009-12-10') = 1, (availables.price*0.66795805223432), '')) AS day2, MAX(IF(to_days(availables.bookdate) - to_days('2009-12-10') = 2, (availables.price*0.66795805223432), '')) AS day3, MAX(IF(to_days(availables.bookdate) - to_days('2009-12-10') = 3, (availables.price*0.66795805223432), '')) AS day4, MAX(IF(to_days(availables.bookdate) - to_days('2009-12-10') = 4, (availables.price*0.66795805223432), '')) AS day5, MAX(IF(to_days(availables.bookdate) - to_days('2009-12-10') = 5, (availables.price*0.66795805223432), '')) AS day6, MAX(IF(to_days(availables.bookdate) - to_days('2009-12-10') = 6, (availables.price*0.66795805223432), '')) AS day7, MIN(spots) as spots FROM `availables` INNER JOIN rooms ON availables.room_id=rooms.id WHERE rooms.hotel_id = '5064' AND bookdate BETWEEN '2009-12-10' AND DATE_ADD('2009-12-10', INTERVAL 6 DAY) GROUP BY rooms.name ORDER BY rooms.ppl My first stab which doesn't work, probably because the DAYSOFWEEK function is much different from the to_days... SELECT rooms.id, rooms.name, MAX(IF(DAYOFWEEK(availables.bookdate) - DAYOFWEEK('2009-12-10') = 0, (availables.price*0.66795805223432), '')) AS day1, MAX(IF(DAYOFWEEK(availables.bookdate) - DAYOFWEEK('2009-12-10') = 1, (availables.price*0.66795805223432), '')) AS day2, MAX(IF(DAYOFWEEK(availables.bookdate) - DAYOFWEEK('2009-12-10') = 2, (availables.price*0.66795805223432), '')) AS day3, MAX(IF(DAYOFWEEK(availables.bookdate) - DAYOFWEEK('2009-12-10') = 3, (availables.price*0.66795805223432), '')) AS day4, MAX(IF(DAYOFWEEK(availables.bookdate) - DAYOFWEEK('2009-12-10') = 4, (availables.price*0.66795805223432), '')) AS day5, MAX(IF(DAYOFWEEK(availables.bookdate) - DAYOFWEEK('2009-12-10') = 5, (availables.price*0.66795805223432), '')) AS day6, MAX(IF(DAYOFWEEK(availables.bookdate) - DAYOFWEEK('2009-12-10') = 6, (availables.price*0.66795805223432), '')) AS day7,rooms.ppl AS spots FROM `availables` INNER JOIN `rooms` ON `rooms`.id = `availables`.room_id WHERE (rooms.hotel_id = 5064 AND rooms.ppl > 3 AND availables.price > 0 AND availables.spots > 1) GROUP BY rooms.name ORDER BY rooms.ppl Maybe i'm making this crazy hard and someone knows a much simpler way. It takes data that looks like this #Availables id room_id price spots bookdate 1 26 $5 5 2009-10-20 2 26 $6 5 2009-10-21 to: +----+-------+--------------------+---------------------+---------------------+---------------------+------+------+------+------+ | id | spots | name | day1 | day2 | day3 | day4 | day5 | day6 | day7 | +----+-------+--------------------+---------------------+---------------------+---------------------+------+------+------+------+ | 25 | 4 | Blue Room | 14.9889786921381408 | 14.9889786921381408 | 14.9889786921381408 | | | | | | 26 | 6 | Whatever | 13.7398971344599624 | 13.7398971344599624 | 13.7398971344599624 | | | | | | 27 | 8 | Some name | 11.2417340191036056 | 11.2417340191036056 | 11.2417340191036056 | | | | | | 28 | 8 | Another | 9.9926524614254272 | 9.9926524614254272 | 9.9926524614254272 | | | | | | 29 | 10 | Stuff | 7.4944893460690704 | 7.4944893460690704 | 7.4944893460690704 | | | | | +----+-------+--------------------+---------------------+---------------------+---------------------+------+------+------+---

    Read the article

  • How to fill DataGridView from nested table oracle

    - by arkadiusz85
    I want to create my type: CREATE TYPE t_read AS OBJECT ( id_worker NUMBER(20), how_much NUMBER(5,2), adddate_r DATE, date_from DATE, date_to DATE ); I create a table of my type: CREATE TYPE t_tab_read AS TABLE OF t_read; Next step is create a table with my type: enter code hereCREATE TABLE Reading ( id_watermeter NUMBER(20) constraint Watermeter_fk1 references Watermeters(id_watermeter), read t_tab_read ) NESTED TABLE read STORE AS store_read ; Microsoft Visual Studio can not display this type in DataGridView. I use Oracle.Command: C# using Oracle.DataAccess; using Oracle.DataAccess.Client; private void button1_Click(object sender, EventArgs e) { try { //my working class to connect to database ConnectionClass.BeginConnection(); OracleDataAdapter tmp = new OracleDataAdapter(); tmp = ConnectionClass.ReadCommand(ReadClass.test()); DataSet dataset4 = new DataSet(); tmp.Fill(dataset4, "Read1"); dataGridView4.DataSource = dataset4.Tables["Read1"]; } catch (Exception o) { MessageBox.Show(o.Message); } public class ReadClass { public static OracleCommand test() { string sql = "select c.id_watermeter, a. from reading c , table (c.read) a where id_watermeter=1"; ConnectionClass.Command1= new OracleCommand(sql, ConnectionClass.Connection); ConnectionClass.Command1.CommandType = CommandType.Text; return ConnectionClass.Command1; } } I tray: string sql = "select r.id_watermeter, o.id_worker, o.how_much, o.adddate_r, o.date_from, o.date_to from reading r, table (r.read) o where r.id_watermeter=1" string sql = "select a.from reading c , Table (c.read) a where id_watermeter=1" string sql = "select a.id_worker, a.how_much, a.adddate_r, a.date_from, a.date_to from reading c , table (c.read) a where id_watermeter=1" string sql = "select c.id_watermeter, a. from reading c , table (c.read) a where id_watermeter=1" Error : Unsuported Oracle data type USERDEFINED encountered Sombady can help me how to fill DataGridView using data from nested table. I am using Oracle 10g XE

    Read the article

  • problem in table:

    - by Ayyappan.Anbalagan
    i had table inside the another table, my inner table display the image, if i enter the text after the inner table,The text should display right side of the table and the bottom of the inner table.how do i do this??? "the below code display the outer table text always displayed bellow the inner table" Heading ## <tr style=" width:500px; float:left;"> <td style="border: thin ridge #008000; text-align:left;" align="left"; > <table class="" style=" border: 1px solid #800000; width:200px; float:left; height: 200px;"> <tr> <td>&nbsp;stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow&nbsp; </td> </tr> </table> stackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow statackoverflow sta</td> </tr> </table>

    Read the article

  • Database Backup History From MSDB in a pivot table

    - by steveh99999
    I knocked up a nice little query to display backup history for each database in a pivot table format.I wanted to display the most recent full, differential, and transaction log backup for each database. Here's the SQL :-WITH backupCTE AS (SELECT name, recovery_model_desc, d AS 'Last Full Backup', i AS 'Last Differential Backup', l AS 'Last Tlog Backup' FROM ( SELECT db.name, db.recovery_model_desc,type, backup_finish_date FROM master.sys.databases db LEFT OUTER JOIN msdb.dbo.backupset a ON a.database_name = db.name WHERE db.state_desc = 'ONLINE' ) AS Sourcetable   PIVOT (MAX (backup_finish_date) FOR type IN (D,I,L) ) AS MostRecentBackup ) SELECT * FROM backupCTE Gives output such as this :-  With this query, I can then build up some straightforward queries to ensure backups are scheduled and running as expected -For example, the following logic can be used ;-  - WHERE [Last Full Backup] IS NULL) - ie database has never been backed up.. - WHERE [Last Tlog Backup] < DATEDIFF(mm,GETDATE(),-60) AND recovery_model_desc <> 'SIMPLE') - transction log not backed up in last 60 minutes. - WHERE [Last Full Backup] < DATEDIFF(dd,GETDATE(),-1) AND [Last Differential Backup] < [Last Full Backup]) -- no backup in last day.- WHERE [Last Differential Backup] < DATEDIFF(dd,GETDATE(),-1) AND [Last Full Backup] < DATEDIFF(dd,GETDATE(),-8) ) -- no differential backup in last day when last full backup is over 8 days old.   

    Read the article

  • problem in html, table class text stretching out.

    - by Andy
    Hey people, I've got a slight problem after weeks of html programming. I've got a large table which I use to construct tabs with, details don't really matter. On every tab there is a tab title (which is defined as one single cell in a table with a class from a .css) and under it there are other rows and columns for the table. sample code for the single table with the single cell in it: <table class='tabcontainer_title'><tr><td class='tabcontainer_title'>TEXT</td></tr></table> This table is again positioned in one cell of the table outside it, which has a different class 'tabcontainer_content' This is in the CSS: .tabcontainer_title{ background-color : #58af34; background-image : url(); text-align : right; vertical-align : top; margin-top : 0px; margin-right : 0px; margin-bottom : 0px; margin-left : 0px; padding-top : 5px; padding-right : 10px; padding-bottom : 5px; padding-left : 0px; font-size : 14px; font-style : normal; color : #000000; } .tabcontainer_content{ width : 100%; font-weight : bolder; background-color : #58af34; color : #000000; padding : 0px; border-collapse : collapse; } The problem I'm experiencing right now is that if there are like 3 rows in the table, which means there's a lot of emtpy space instead of those rows, the text in the tab title has a large margin from the top: but I haven't configured any margin to be present. When the table is full of rows though, hence the table is full, then the tab title holds no unnecessary empty space above the text. What am I missing here?

    Read the article

  • Inheritance Mapping Strategies with Entity Framework Code First CTP5: Part 2 – Table per Type (TPT)

    - by mortezam
    In the previous blog post you saw that there are three different approaches to representing an inheritance hierarchy and I explained Table per Hierarchy (TPH) as the default mapping strategy in EF Code First. We argued that the disadvantages of TPH may be too serious for our design since it results in denormalized schemas that can become a major burden in the long run. In today’s blog post we are going to learn about Table per Type (TPT) as another inheritance mapping strategy and we'll see that TPT doesn’t expose us to this problem. Table per Type (TPT)Table per Type is about representing inheritance relationships as relational foreign key associations. Every class/subclass that declares persistent properties—including abstract classes—has its own table. The table for subclasses contains columns only for each noninherited property (each property declared by the subclass itself) along with a primary key that is also a foreign key of the base class table. This approach is shown in the following figure: For example, if an instance of the CreditCard subclass is made persistent, the values of properties declared by the BillingDetail base class are persisted to a new row of the BillingDetails table. Only the values of properties declared by the subclass (i.e. CreditCard) are persisted to a new row of the CreditCards table. The two rows are linked together by their shared primary key value. Later, the subclass instance may be retrieved from the database by joining the subclass table with the base class table. TPT Advantages The primary advantage of this strategy is that the SQL schema is normalized. In addition, schema evolution is straightforward (modifying the base class or adding a new subclass is just a matter of modify/add one table). Integrity constraint definition are also straightforward (note how CardType in CreditCards table is now a non-nullable column). Another much more important advantage is the ability to handle polymorphic associations (a polymorphic association is an association to a base class, hence to all classes in the hierarchy with dynamic resolution of the concrete class at runtime). A polymorphic association to a particular subclass may be represented as a foreign key referencing the table of that particular subclass. Implement TPT in EF Code First We can create a TPT mapping simply by placing Table attribute on the subclasses to specify the mapped table name (Table attribute is a new data annotation and has been added to System.ComponentModel.DataAnnotations namespace in CTP5): public abstract class BillingDetail {     public int BillingDetailId { get; set; }     public string Owner { get; set; }     public string Number { get; set; } } [Table("BankAccounts")] public class BankAccount : BillingDetail {     public string BankName { get; set; }     public string Swift { get; set; } } [Table("CreditCards")] public class CreditCard : BillingDetail {     public int CardType { get; set; }     public string ExpiryMonth { get; set; }     public string ExpiryYear { get; set; } } public class InheritanceMappingContext : DbContext {     public DbSet<BillingDetail> BillingDetails { get; set; } } If you prefer fluent API, then you can create a TPT mapping by using ToTable() method: protected override void OnModelCreating(ModelBuilder modelBuilder) {     modelBuilder.Entity<BankAccount>().ToTable("BankAccounts");     modelBuilder.Entity<CreditCard>().ToTable("CreditCards"); } Generated SQL For QueriesLet’s take an example of a simple non-polymorphic query that returns a list of all the BankAccounts: var query = from b in context.BillingDetails.OfType<BankAccount>() select b; Executing this query (by invoking ToList() method) results in the following SQL statements being sent to the database (on the bottom, you can also see the result of executing the generated query in SQL Server Management Studio): Now, let’s take an example of a very simple polymorphic query that requests all the BillingDetails which includes both BankAccount and CreditCard types: projects some properties out of the base class BillingDetail, without querying for anything from any of the subclasses: var query = from b in context.BillingDetails             select new { b.BillingDetailId, b.Number, b.Owner }; -- var query = from b in context.BillingDetails select b; This LINQ query seems even more simple than the previous one but the resulting SQL query is not as simple as you might expect: -- As you can see, EF Code First relies on an INNER JOIN to detect the existence (or absence) of rows in the subclass tables CreditCards and BankAccounts so it can determine the concrete subclass for a particular row of the BillingDetails table. Also the SQL CASE statements that you see in the beginning of the query is just to ensure columns that are irrelevant for a particular row have NULL values in the returning flattened table. (e.g. BankName for a row that represents a CreditCard type) TPT ConsiderationsEven though this mapping strategy is deceptively simple, the experience shows that performance can be unacceptable for complex class hierarchies because queries always require a join across many tables. In addition, this mapping strategy is more difficult to implement by hand— even ad-hoc reporting is more complex. This is an important consideration if you plan to use handwritten SQL in your application (For ad hoc reporting, database views provide a way to offset the complexity of the TPT strategy. A view may be used to transform the table-per-type model into the much simpler table-per-hierarchy model.) SummaryIn this post we learned about Table per Type as the second inheritance mapping in our series. So far, the strategies we’ve discussed require extra consideration with regard to the SQL schema (e.g. in TPT, foreign keys are needed). This situation changes with the Table per Concrete Type (TPC) that we will discuss in the next post. References ADO.NET team blog Java Persistence with Hibernate book a { text-decoration: none; } a:visited { color: Blue; } .title { padding-bottom: 5px; font-family: Segoe UI; font-size: 11pt; font-weight: bold; padding-top: 15px; } .code, .typeName { font-family: consolas; } .typeName { color: #2b91af; } .padTop5 { padding-top: 5px; } .padTop10 { padding-top: 10px; } p.MsoNormal { margin-top: 0in; margin-right: 0in; margin-bottom: 10.0pt; margin-left: 0in; line-height: 115%; font-size: 11.0pt; font-family: "Calibri" , "sans-serif"; }

    Read the article

  • How to delete child table records during the update of parent table using Hibernate

    - by Harsha
    I have a Parent Table A and child tables B,C with many to one relations. Lets say I have data like, for primary key 1 in parent table A I have 3 rows in child table B and 4 rows in child table C. Now if I want to delete the rows of the child table during an update of the parent table(that means Now, I want to update the table only with one row in each child tables and delete the other rows in them) then how to handle this scenario in hibernate?

    Read the article

  • Is it possible to filter data used by pivot table based on filtering the rows in a source table in Excel?

    - by Geoffrey Stoel
    I have developed a dashboard in Excel 2007 that uses one source table in a sheet (being filled with a query on our data warehouse) and multiple pivot tables making different cross sections on this data. I use the GETPIVOTDATA in almost a hundred formulas to give me the right value for a specific indicator in my dashboard. This all works fine. However I now have received the question to make the dashboard for 5 different segments. As you can imagine I don't want to create 5 different workbooks for this and need to maintain the dashboard logic on all of them. So my question is the following. Is it possible to automatically (through VBA or any other means) filter the results in my source table which is the source for my pivot tables and thus for my dashboard values. So schematically: DATABASE_VIEW -- SOURCE_TABLE -- 12 pivot tables -- 100 GETPIVOTDATA functions Preferably I would like to load all the segments in the source_table (one view on my database) and then filter the data in the source table, which results in filterd source_dat for my pivots. This way I can (without requerying the db) quickly change between segments in the dashboards (refreshing pivots only). Data in the source table has the column: CUSTOMER_SEGMENT available to filter upon. Any help is appreciated. Geoffrey

    Read the article

  • INSERT 0..n records into table 'A' based on content of table 'B' in MySql 5

    - by Robert Gowland
    Using MySql 5, I have a task where I need to update one table based on the contents of another table. For example, I need to add 'A1' to table 'A' if table 'B' contains 'B1'. I need to add 'A2a' and 'A2b' to table 'A' if table 'B' contains 'B2', etc.. In our case, the value in table 'B' we're interested is an enum. Right now I have a stored procedure containing a series of statements like: INSERT INTO A SELECT 'A1' FROM B WHERE B.Value = 'B1'; --Repeat for 'B2' -> 'A2a'; 'B2' -> 'A2b'; 'B3' -> 'A3', etc... Is there a nicer more DRY way of accomplishing this? Edit: There may be values in table 'B' that have no equivalent value for table 'A'.

    Read the article

  • mysql master slave "table already exists" but table not exists

    - by Korjavin Ivan
    I have 1 master mysql process, and 2 slave. Today on both slaves i see : Error 'Table 'bgbilling.contract_status_balance_dump' already exists' on query. Default database: 'bgbilling'. Query: 'CREATE TABLE contract_status_balance_dump( UNIQUE(cid) ) SELECT cid, MAX(yy*12+(mm-1))%12 + 1 AS mm,FLOOR(MAX(yy*12+(mm-1)) / 12) AS yy FROM contract_balance GROUP BY cid' "show tables" does not show this table. I tryed stop slave , and do "drop table contract_status_balance_dump" but: ERROR 1051 (42S02): Unknown table 'contract_status_balance_dump' How its possible? And how fix that?

    Read the article

  • Quaternion based rotation and pivot position

    - by Michael IV
    I can't figure out how to perform matrix rotation using Quaternion while taking into account pivot position in OpenGL.What I am currently getting is rotation of the object around some point in the space and not a local pivot which is what I want. Here is the code [Using Java] Quaternion rotation method: public void rotateTo3(float xr, float yr, float zr) { _rotation.x = xr; _rotation.y = yr; _rotation.z = zr; Quaternion xrotQ = Glm.angleAxis((xr), Vec3.X_AXIS); Quaternion yrotQ = Glm.angleAxis((yr), Vec3.Y_AXIS); Quaternion zrotQ = Glm.angleAxis((zr), Vec3.Z_AXIS); xrotQ = Glm.normalize(xrotQ); yrotQ = Glm.normalize(yrotQ); zrotQ = Glm.normalize(zrotQ); Quaternion acumQuat; acumQuat = Quaternion.mul(xrotQ, yrotQ); acumQuat = Quaternion.mul(acumQuat, zrotQ); Mat4 rotMat = Glm.matCast(acumQuat); _model = new Mat4(1); scaleTo(_scaleX, _scaleY, _scaleZ); _model = Glm.translate(_model, new Vec3(_pivot.x, _pivot.y, 0)); _model =rotMat.mul(_model);//_model.mul(rotMat); //rotMat.mul(_model); _model = Glm.translate(_model, new Vec3(-_pivot.x, -_pivot.y, 0)); translateTo(_x, _y, _z); notifyTranformChange(); } Model matrix scale method: public void scaleTo(float x, float y, float z) { _model.set(0, x); _model.set(5, y); _model.set(10, z); _scaleX = x; _scaleY = y; _scaleZ = z; notifyTranformChange(); } Translate method: public void translateTo(float x, float y, float z) { _x = x - _pivot.x; _y = y - _pivot.y; _z = z; _position.x = _x; _position.y = _y; _position.z = _z; _model.set(12, _x); _model.set(13, _y); _model.set(14, _z); notifyTranformChange(); } But this method in which I don't use Quaternion works fine: public void rotate(Vec3 axis, float angleDegr) { _rotation.add(axis.scale(angleDegr)); // change to GLM: Mat4 backTr = new Mat4(1.0f); backTr = Glm.translate(backTr, new Vec3(_pivot.x, _pivot.y, 0)); backTr = Glm.rotate(backTr, angleDegr, axis); backTr = Glm.translate(backTr, new Vec3(-_pivot.x, -_pivot.y, 0)); _model =_model.mul(backTr);///backTr.mul(_model); notifyTranformChange(); }

    Read the article

  • Vaadin table hide columns and container customization

    - by Alex
    Hello I am testing a project, using Vaadin and Hibernate. I am trying to use the HbnContainer class to show data into table. The problem is that I do not want to show all the properties of the two classes in the table. For example: @Entity @Table(name="users") class User { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; private String name; @ManyToOne(cascade=CascadeType.PERSIST) private UserRole role; //getters and setters } and a second class: @Entity @Table(name="user_roles") class UserRole { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; private String name; //getters and setters } Next, I retrieve my data using the HbnContainer, and connect it to the table: HbnContainer container = new HbnContainer(User.class, app); table.setContainerDataSource(container); The Table will only display the columns from User, and for the "role" it will put the role id instead. How can I hide that column, and replace it with the UserRole.name ? I managed to use a ColumnGenerator() to get the string value in the table, for the UserRole - but I couldn't remove the previous column, with the numerical value. What am I missing? Or, what is the best way to "customize" your data, before displaying a table (if i want to show data in a table from more than one object type.. what do I do?) If I can't find a simple solution soon, I think I will just build the tables "by hand".. So, any advice on this matter? Thank you, Alex

    Read the article

  • Dojo Table not Rendering in IE6

    - by Mike Carey
    I'm trying to use Dojo (1.3) checkBoxes to make columns appear/hide in a Dojo Grid that's displayed below the checkBoxes. I got that functionality to work fine, but I wanted to organize my checkBoxes a little better. So I tried putting them in a table. My dojo.addOnLoad function looks like this: dojo.addOnLoad(function(){ var checkBoxes = []; var container = dojo.byId('checkBoxContainer'); var table = dojo.doc.createElement("table"); var row1= dojo.doc.createElement("tr"); var row2= dojo.doc.createElement("tr"); var row3= dojo.doc.createElement("tr"); dojo.forEach(grid.layout.cells, function(cell, index){ //Add a new "td" element to one of the three rows }); dojo.place(addRow, table); dojo.place(removeRow, table); dojo.place(findReplaceRow, table); dojo.place(table, container); }); What's frustrating is: 1) Using the Dojo debugger I can see that the HTML is being properly generated for the table. 2) I can take that HTML and put just the table in an empty HTML file and it renders the checkBoxes in the table just fine. 3) The page renders correctly in Firefox, just not IE6. The HTML that is being generated looks like so: <div id="checkBoxContainer"> <table> <tr> <td> <div class="dijitReset dijitInline dijitCheckBox" role="presentation" widgetid="dijit_form_CheckBox_0" wairole="presentation"> <input class="dijitReset dijitCheckBoxInput" id="dijit_form_CheckBox_0" tabindex="0" type="checkbox" name="" dojoattachevent= "onmouseover:_onMouse,onmouseout:_onMouse,onclick:_onClick" dojoattachpoint="focusNode" unselectable="on" aria-pressed="false"/> </div> <label for="dijit_form_CheckBox_0"> Column 1 </label> </td> <td> <div class="dijitReset dijitInline dijitCheckBox" role="presentation" widgetid="dijit_form_CheckBox_1" wairole="presentation"> <input class="dijitReset dijitCheckBoxInput" id="dijit_form_CheckBox_1" tabindex="0" type="checkbox" name="" dojoattachevent= "onmouseover:_onMouse,onmouseout:_onMouse,onclick:_onClick" dojoattachpoint="focusNode" unselectable="on" aria-pressed="false"/> </div> </td> </tr> <tr> ... </tr> </table> </div> I would have posted to the official DOJO forums, but it says they're deprecated and they're using a mailing list now. They said if a mailing list doesn't work for you, use stackoverflos.com. So, here I am! Thanks for any insight you can provide.

    Read the article

  • How to resize table via javascript in IE?

    - by MartyIX
    I've got this table: <table id="correctness" style="overflow: hidden;"> <tr><td style="overflow: hidden;"> <div id="correctness-message"></div> <span class="hide"> <button type="button" class="hide" onclick="new DisplayEffect('correctness').Hide(500);">Hide</button> </span> </td> </tr> </table> and a function for resizing the table: function resize(element, size) { element.style.height = size + "px";}; which is called for a certain amount of time (e.g. 1 second) with the ID of table (i.e. "correctness") in order to resize the table from zero height to its full height. This code works in Firefox and Chrome but it doesn't work in IE8. What it does is that it displays right away whole table even thought the height set in "resize" method is much lower. It seems that the cell sets the height of parent table and not the other way around. Is it possible to change the behaviour? I like changing the height of the table better because I can set visibility of the table easily. Thanks for any help!

    Read the article

  • mysql alter to table

    - by user485783
    Hi, I drop the mysql alter code below to database via phpmyadmin one by one, it it work fine, is there anyone could help me how to drop it all together at once? or do you know the the samples of php code that may execute it? just let me know please. thanks in advace ALTER TABLE user ADD title varchar(16) COLLATE utf8_bin NOT NULL DEFAULT '' AFTER user_id ALTER TABLE customer ADD title varchar(16) COLLATE utf8_bin NOT NULL DEFAULT '' AFTER customer_id ALTER TABLE customer ADD date_birtdate datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER lastname ALTER TABLE customer ADD security_question varchar(96) COLLATE utf8_bin NOT NULL DEFAULT '' AFTER fax ALTER TABLE customer ADD security_answer varchar(96) COLLATE utf8_bin NOT NULL DEFAULT '' AFTER fax ALTER TABLE customer ADD pin_number text COLLATE utf8_bin AFTER password ALTER TABLE customer ADD notes text COLLATE utf8_bin AFTER bank_number ALTER TABLE customer ADD last_active datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER date_added

    Read the article

  • When to use SQL Table Alias

    - by Rossini
    I curious to know how people are using table alias. The other developers where I work always use table alias, and always use the alias of a, b, c, ect. Here's an example SELECT a.TripNum, b.SegmentNum, b.StopNum, b.ArrivalTime FROM Trip a, Segment b WHERE a.TripNum = b.TripNum I disagree with them, and think table alias should be use more sparingly. I think it should be used when including the same table twice in a query, or when the table name is very long and using a shorter name in the query will make the query easier to read. I also think the alias should be a good name instead of a letter. In the above example if I felt I needed to use 1 letter table alias I would use t for the Trip table and s for the segment table.

    Read the article

  • Adjust width of td to make make row widths even

    - by user1729886
    I am trying to produce a table with a different number of cells in each row. The first row is a header row (every other row contains cells). This header is the width of the table. The second row has 2 cells in it... the third has 1 cell... the fourth has 4 cells... the fifth and final row has 3 cells. I want the table set up so that the rows span the full width of the table. If the table is 1000px... The header would be 1000px wide the cells in the 2nd row would be 500px EACH the cell in the 3rd row would be 1000px the cells in the 4th row would be 250px EACH and the cells in the 5th row would be 333px, 334px, and 333px each (left-to-right) I figured out I could use colspan for the first 4 rows, but the 5th (with 3 cells) would require a non-integer value. The cells in the 5th row won't expand beyond their column without colspan that I can tell... trying the width:## CSS code inside a div tag for each cell inside the td tag creating a class or classes that define the cell widths id-ing each cell, with or without a div tag, and defining widths individually and adjuting the table-layout: option After several days, I'm now at my rope's end. The only thing I can come up with is deliberately tripling the number of cells in each row so that colspan would be all integer values. That sounds inconvenient and unreasonably difficult to format the table the way I'd like. It's a table of Batman movies for a website -- a practice website I'm building, in order to learn HTML/CSS. I've been working on-and-off with HTML for several months, and CSS for a few weeks. PS: It is not being used for layout, I am simply trying to adjust the layout of the table itself.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >