I'd do this check in the where clause and use the Java side to simply check if this query returned any results: Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement ("SELECT questid FROM completedQuests WHERE characterid = ? AND questid = ?"); ps.setInt (1, characterId); ps.setInt (2, questId); ResultSet rs...

Try this SELECT count(receiver_id) as total_receiver FROM gr_group_memberships INNER JOIN gr_group on gr_group_memberships.group_id = gr_group.id GROUP BY gr_group_memberships.receiver_id ORDER BY gr_group_memberships.receiver_id DESC I think it will worked what you want...

The answer is no, tables won't be locked, database won't be down. But, if your database is large and it takes long time to backup it, you can sometimes expect performance degradation(slow SQL queries from your application).

You can find the id values from the ISearchResponse (based on your code example above) by looking at the objects in the Hits collection, rather than the Documents collection. Each Hit has an Id property. In the original indexing call (assuming you're doing that individually -- not via the _bulk...

The Cognos _days_between function works with dates, not with datetimes. Some databases, like Oracle, store all dates with a timestamp. On a query directly to the datasource, try using the database's functions to get this data instead. When possible, this is always preferable as it pushes work to the database,...

Redis would probably be fastest, especially if you don't need a durability guarantee - most of the game can be played out using Redis' in-memory datastore, which is probably gonna be faster than writing to any disk in the world. Perhaps periodically, you can write the "entire game" to disk....

The point of a connection pool is to remove the overhead of establishing connections to the database. It does this by maintaining a "pool" of constantly alive connections, ready for use. If your workloads are "spikey" with long periods of no activity, but occasional periods of lots of activity, I...

typically, you would store the password as some sort of encrypted hash. It is best if this is one-way, so it cannot be decrypted. When authenticating, you check that you can generate the same hash from the provided password; not decypt what is stored. Your hash should also be "salted"...

Unfortunately this not possible at this time. You can export to another single node, then add a node. As a side note, you want at least 3 nodes for a production environment. For users, roles and permissions, see datadug.com's export script. With regards to moving data, you have a few...

In an object oriented language, would you make a class for every user? Or would you have an instance of a class for each user? Having one table per user is a really bad design. You can't search messages based on any field that isn't the username. With your current...

Gordon should have credit for writing this out. But I think you probably just want to append a column with the appropriate descriptor and probably sort them in the order you'd like to see them. select title, case when date = curdate() then 'today' when date >= curdate() - interval...

Your b is null. You didn't put anything in intent and you are fetching from intent. Put "score" in intent in SaveDataActivity then fetch from intent in ResultActivity. How to use putExtra() and getExtra() for string data...

The key here is to step back and think about the problem from another angle. You are duplicating lots of code because you are creating instances of the database and command classes within the method. So inject them instead: public class SomeDBClass { static DataTable exec_DT(DBConnection conn, DBCommand cmd) {...

The main database is always named main, you cannot change that name. You can just create an in-memory database and attach your database to that using an arbitrary name: conn = sqlite3.connect(':memory:') conn.execute("attach ? as 'schemaname'", (filename,)) However, if you are going to be using the database as a fallback...

The method you're looking for is QSqlQuery::lastInsertId(). To quote the documentation: Returns the object ID of the most recent inserted row if the database supports it. An invalid QVariant will be returned if the query did not insert any value or if the database does not report the id back....

You need to use the column formatter function for rendering data. check the jsfiddle over here. Check the examples over here I have taken this example and modified as per your needs. require([ 'dgrid/Grid', 'dojo/domReady!' ], function(Grid) { var data = [ { id: 1, number: 7 }, { id:...

In the TO_DATE function you have to keep the format. The first parameter is the data and the second parameter is the format you are putting it. For example: to_date('29-Oct-09', 'DD-Mon-YY') to_date('10/29/09', 'MM/DD/YY') to_date('120109', 'MMDDYY') to_date('29-Oct-09', 'DD-Mon-YY HH:MI:SS') to_date('Oct/29/09', 'Mon/DD/YY HH:MI:SS') to_date('October.29.2009', 'Month.DD.YYYY HH:MI:SS') So if you put TO_DATE('05-06-2015','yyyy/mm/dd HH24:MI:SS')...

Your problem is in view :) Change report to Report. Now when you are saving $this->request->data its trying to find Report key to be able to save , or report field in your database. If you dont want change this , in controller you can save $this->request->data['report'] Edit Also if...

As the error suggests, web ui doesn't support adding more leaves on the same machine. However, you can add more leaves on the same machine via command line: memsql-ops memsql-deploy --role leaf --port 9000 While web-ui cannot add a new leaf, it will be able to manage it once it...

You can use a trigger to autofill another table. DELIMITER $$ CREATE TRIGGER init_cross AFTER INSERT ON item FOR EACH ROW BEGIN INSERT INTO `cross`(item,equip) VALUES( NEW.item, NEW.equip ); END; $$ DELIMITER ; ...

Your query will list non-existing jobs in case the database has orphan records in applicant and qualified, and might also omit jobs that have no qualified and willing candidates. I'm not exactly sure, because I have no idea if there's any database that will accept COUNT(a-id) when there's no information...

Sure! Host a WebService for sharing data amongst devices. Using a simple php script to insert and select will allow you to achieve this. Something like this blog would help develop understanding of web services if you want a place to start....

As @Craig explained, you can't (and even if you could, it would be fairly pointless). The usual way of implementing restricted superuser permissions is to connect as an existing superuser role, and create SECURITY DEFINER functions containing a limited set of approved commands. These functions will now be executed with...

I would use case one but with some changes. The parameter entity does hold one thing, parameters for a table. An instance of a parameter entry should relate to only one table (based on your analysis that they are not related). Parameter ---------- PK Param_ID FK Main_Table_ID Main_Table_name (A or...

So there is no native way to do this. So the best answer should be: "select * from ..." each table you want to backup and iterate through results while inserting this data into new "backup" database. So there is no simpler way as "rename" or "backup". Thank you @Chuck...

Placeholders ('?') can only be used to insert dynamic, escaped values for filter parameters (e.g. in the WHERE part), where data values should appear, not for SQL keywords, identifiers etc. You cannot use it to dynamically specify the ORDER BY OR GROUP BY values. You can still do it though,...

Use function hook_watchdog(array $log_entry) { } where $log_entry is an array with all the log data you need. Read more: https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_watchdog/7...

You should change your code to something like the following. Note that Everything that returns an object like OleDbConnection, OleDbCommand, or OleDbDataReader is wrapped in a Using block. These objects all implement the IDisposable interface, which means they should be cleaned up as soon as you're done with them. Also...

There are a number of problems in your code, but the one that causes the actual problems you're having is the fact that your function pie does not increment the values you fetched from the DB, that's done outside of the function, but the incremented values aren't used there: function...

I would update, otherwise you keep adding more and more data which you are not going to use. Maybe you won't run into problems with this specific case (because people won't select tens of thousands of persons a day), but in general you should be careful with just adding data...

No. Well, not exactly. A db.collection.find() will give you the documents in the order they appear in the datafiles host of the times, though this isn't guaranteed. Result Ordering Unless you specify the sort() method or use the $near operator, MongoDB does not guarantee the order of query results. As...

Well, Both the actions actually means update, where PUT is full update and PATCH is partial update. In case of PUT you already know the identifier of the resource and the resource already exists, so it is not a create and delete action per se. Infact, you can make do...

This should work: SELECT products.* FROM products, product_category WHERE product_category.categoryid = CATEGORY_ID AND products.catalogid = product_category.catalogid Or if you prefer a join: SELECT products.* FROM products INNER JOIN product_category ON products.catalogid = product_category.catalogid WHERE product_category.categoryid = CATEGORY_ID Simply replace CATEGORY_ID by the ID of the category you wish to select....

your query is wrong SQL SERVER the syntax for datediff is DATEDIFF(datepart,startdate,enddate) Also the function for getting current date in sql server is getdate() not now() so in your case it will be Select DATEDIFF(DAY,reservations.checkin_date, getdate()) eg:- select DATEDIFF(Day,'06-07-2015 14:00:00',GETDATE()) will return 10 MS-ACCESS DateDiff ( interval, date1, date2, [firstdayofweek],...

The only way to do this is to manually run a count(*) on all of your tables filtering on the particular date field. The reason for this is because one table might have a column "CreatedDate" that you need to check if it's >30 days old, while another might have...

The problem here is not pandas, it is the UPDATE operations. Each row will fire its own UPDATE query, meaning lots of overhead for the database connector to handle. You are better off using the df.to_csv('filename.csv') method for dumping your dataframe into CSV, then read that CSV file into your...

You are using a cursor, to start with... I would go with an update statement using a join to a derived table. Something like this should do the trick: UPDATE t1 SET TInterest = SumTInterest FROM PersonalLedgerForTFundAndShareClone t1 INNER JOIN ( SELECT EmNo, SUM(TInterest) AS SumTInterest FROM PersonalLedgerForTFundAndShareClone WHERE TDate...

You can run mysqldump -h yourhostname -u youruser -p yourdatabasename > C:\your\file\path.sql -h connects you to the remote servers IP so you can dump the data locally, as long as your user has the correct privileges and you can connect remotely to your database server. However, you may need to...

You could set-up a backend using some database (eg. MySQL) and some programming language (eg. PHP) as well as some kind of web-server (eg. Apache). You would store the products,user data in tables of the database. Pictures would be stored on some directory on your server and you could store...

It seems to be Windows UAC reliant. As our application run in compatibility mode, UAC visualization is active and causing may some problems. The reason for this is, that the COBOL databse is a file based database, and the client where are coding for uses these files in ODBC DSN...

I think that you are providing in your connection string UserName and password, so you can change from Integrated Security=True to Integrated Security=False and if the user 'DB_9CB321_Szklarnia_admin' has rights to connect it will work. When Integrated Security=True the userID and password will be ignored and attempt will be made...

You need to use this syntax when updating with a join: UPDATE s SET s.[columnName] = l.[columnName] FROM [Server].[ServerDB].[dbo].[tableName] s INNER JOIN [LocalDB].[dbo].[tableName] l ON l.id = s.id ...

The query to prepare should be insert into test values(?,lo_import(?)); You proposal insert into test values(?,?) can't work because you can't submit a SQL function call (lo_import) as the value for a placeholder (?). Placeholders only fit where a literal value would fit. When you're asking what's the prepared statement...

You cannot just use an INSERT .... SELECT construct. You need to use the sys.users info to generate CREATE USER statements and execute those statements. If this is a one time thing, I would use select 'CREATE USER [' + uu.name + '] FOR LOGIN ' + ll.name + '...

I don't think you need to first query the db to get the count of records before then going back to the db to get the phonenumbers, you could just do this: mycom.CommandText = "SELECT Cellphone FROM tbl_applicant where Gender='Female';" myr = mycom.ExecuteReader While myr.Read() TextBox1.Text = TextBox1.Text & myr(0)...

Translate that form into Excel. Use "Collect Data" under the "External Data" tab on the ribbon to collect data from customers. To pull data onto your spreadsheet from Access do something like this. Use an Excel spreadsheet for the form. Then make a command button with the following event on...

The solutions I have found are: docker run tomdavidson/initdb bash -c "`cat initdb.sh`" and Set an ENV VAR equal to your script and set up your Docker image to run the script (of course one can ADD/COPY and use host volumes but that is not this question), for example: docker...

I believe you forget finalizing your prepared statements using sqlite3_finalize(), unless you have unmatched open/close calls or you access the db connection from multiple threads. According to sqlite guidelines: If the database connection is associated with unfinalized prepared statements or unfinished sqlite3_backup objects then sqlite3_close() will leave the database connection...

Oracle uses "logical" und "physical" structures to store the data. For this case: The extents of a segment can be stored in different datafiles, so just summing up can work but must not work see here: http://docs.oracle.com/cd/E11882_01/server.112/e40540/logical.htm#CNCPT301 Plus: Oracle has a "High Water Mark" so even if your segment size...

You can import the CSV file into a separate table using mysql LOAD DATA INFILE and then update the entries table using JOIN statement on the basis of similar column name. E.g: update entries a inner join new_table b on a.name = b.name set a.address = b.address ; Here new_table...

What I think you should take note of here is that each post has a department and a postType. If you take a step back, you can select all posts that belong to a certain department and a certain postType like this: SELECT p.* FROM posts p JOIN department d...

If you are looking to find the records matching with both the criteria here is a way of doing it select `item_id` FROM `item_meta` where ( `meta_key` = 'category' and `meta_value` = 'Bungalow' ) or ( `meta_key` = 'location' AND `meta_value` = 'Lagos' ) group by `item_id` having count(*)=2 ...

Why don't you just do it in one single query? Just replace the necessary table and column name, and variables/values/parameters to be bind in your query: $query = mysqli_query($conn, "SELECT first_name, last_name, description, role FROM `wp_usermeta` WHERE `first_name` = '$first_name' OR `last_name` = '$last_name' OR `description` = '$description' OR `role`...

In barely any case would you get direct access to another company's database, even if you are affiliated. The most common way would be an API (which might be public or licensed): https://en.wikipedia.org/wiki/Application_programming_interface If the data is publicly available on a website, some do content parsing although this is not...

Wow this is a really complicated!! The apps can't connect directly with server how do websites... Remember the devices it's possible lose internet, then how you connect with you server database? The most important of devices is can work offline, in this moment our app needs a webservice (API) to...

First add libsqlite3.dylib to your Xcode project (in project settings/Build Phases/Link Binary with Libraries), then use something like fmdb, it makes dealing with SQLite a lot easier. It's written in Objective-C but can be used in a Swift project, too. Then you could write a DatabaseManager class, for example... import...

The best thing to do would depend on what other fields the table has and what other queries run against that table. Without more details, a non-clustered index on (code, company, createddate) that included the "price" column will certainly improve performance. CREATE NONCLUSTERED INDEX IX_code_company_createddate ON Products(code, company, createddate) INCLUDE...

Here are some interesting articles about WCF Services in Windows Phone world. How to consume an OData service for Windows Phone 8 Using WCF Service in Windows Phone 8.1 (same in Windows Phone 8) Now you can host the WCF Service in your own server, hosting provider or anything else....

I knew there were fields that were empty that should have caught the check, but they were empty rather than NULL. So, when I was checking for NULL fields, it didn't find any. What I had to do was set all the empty columns to NULL: UPDATE `table` SET `column`...

To ensure data is available, you can make a refresh request to corresponding index before GET/SEARCH: http://localhost:9200/your_index/_refresh Or refresh all indexes: http://localhost:9200/_refresh ...

As shown in the documentation, you can simply insert the desired values in the PK column: INSERT INTO Type(id, typename) VALUES(2, 'novel') And if you never need autoincrement values, you should not use an autoincrementing column in the first place....

You can Add another table to reduce repeated data for player name card_table -> [card_id], [cardName] player_table -> [player_id] , [playerName] player_card_table -> [player_id],[card_id],[qty] Hope this will help :)...