queries

Changing stored procedure

I have a proc that print checks if there is any new checks to be print. If there is nothing to issue new checks it wont print any. Now i want to modify this proc like even if i don't have any new checks to be print, it should pick up at least one check to be print.( even if it is already printed). Can you tell me how to do that. Here is...

Can I do it only with SQL Queries or do I need a stored procedure?

Hi guys. I came across with a problem in which I need some advice/help. Background: I'm programming a map in an accounting software which requires special formatting and a tree-like hierarchy between the account codes, i.e.: Account 1 is the father of accounts 11, 12 and 13; On the other hand, account 11 is the father of accounts 11...

Load repetitively-named XML nodes using Linq [C#]

Hello, I'm working on a program that needs to be able to load object-properties from an XML file. These properties are configurable by the user and XML makes sense to me to use. Take the following XML document. <?xml version="1.0" encoding="utf-8" ?> <udpcommands> <command name="requser"> <cvar name="reqchallege" value="false"...

Executing oracle queries in Shell Script

Please tell me how can i excute an oralce query inside a shell script.I am writing a shell script where I need to execute the oracle queries and scripts inside the shell script. What is the purpose of these lines sql_file=sachin.sql cat <<!SQL > $sql_file select $1 from dual; exit; !SQL I think they are creating a new...

How do we compare two Query result sets in coldfusion

I need to build a generic method in coldfusion to compare two query result sets... Any Ideas??? ...

why mysql queries takes table lock in isolation read uncommitted?

Is there any way to get mysql queries to not take any locks on myisam tables? My problem seems to be that my Sphinx Search indexer takes a lock on one of my myisam tables for over 60s which seem to make update statements wait on the locks to be released which in turn makes other queries wait for the update statements to complete. The i...

SQL Query Solution - Day By Day Balance

Hello, Every one. first of all, let me explain the table structure. It is as follows. Main Table - CategoryGroup Fields - CatGroupID, GroupName, GroupType Sample Data CatGroupID | GroupName | GroupType 1 | Utility | Expense 2 | Auto | Expense 3 | Misc. | Expense 4 ...

Mysql join query

SELECT description FROM diagnosis_mapping LEFT JOIN diagnosis_codes ON diagnosis_codes.codeid = diagnosis_mapping.codeid SELECT description FROM diagnosis_mapping LEFT JOIN diagnosis_codes ON diagnosis_codes.codeid = diagnosis_mapping.secondarycodeid How to merge these 2 queries and get info in a s...

Find all Products by Tag in Rails with ActiveRecord

This is probably something very simple but I'm looking for the optimal way of retrieving all Products by Tag, so to speak. This is with Spree, so I should stick to the way they have modeled their data. It's actually Product and Taxon (like category, brand, etc.) So if Product has_and_belongs_to_many :taxons and Taxon has_and_belongs_t...

How can I get phpmail to send to the right user and also limit the ammount of emails for certain users? Part 2.

Thanks to Anthony's advice I've tried to simplify my logic and syntax of the goal I am trying to achieve which is when a blog is written, the AUTHOR gets notified by php mail that someone other than himself comments. When the AUTHOR comments everyone else who commented except him gets a different email. When another user comments, the AU...

Need help with Binary Columns

Hi, I have to query a column containing a Binary column with data like this ®â{Õ■K!Eòû▓♫;#§ø. How can i query this colmn..if I wanted something like: SELECT Name FROM Users WHERE ID = ®â{Õ■K!Eòû▓♫;#§ø THanks ...

MySQL: How many queries per page is too many?

I'm new to MySQL and something that's quickly becoming obvious to me is that it feels considerably easier to create several database queries per page as opposed to a few of them.... but I don't really have a feel for how many queries might be too many, or at what point I should invest more precious time to combining queries, spending tim...

Most useful SQL meta-queries

I have a passion for meta-queries, by which I mean queries that answer questions about data rather than answering with data. Before I get a lot of justified criticism, I do realize that the approach of meta-queries is not ideal, as eloquently described here for example. Nevertheless, I believe they do have their place. (So much so that ...

MYSQL: How to find player_id from surname?

Hi, I'm now trying to populate my 'testMatch' table (below) with data from my unormalised 'summary' table: TESTMATCH TABLE +------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------+--------------+------+-----+---------+-------+ | match_id ...

How to club the results of two SQL queries?

SELECT * FROM( (SELECT count(DISTINCT RECEPIENT_ID) as NoOfUsers, TO_CHAR(ACTN_TAKE_DATA_TM,'YYYY-MM-DD') as accDate FROM ALRT_PLATFORM_ALRT_HSTRY where APPL_CD like 'EBP' and ALRT_RSPNS_FROM_CLIENT_ID like 'BB' group by TO_CHAR(ACTN_T...

Mysqli query in PHP isnt working right, is there a way to get the exact query?

Is there a way to get the query after mysqli prepares it? My query is messing up: $query = "UPDATE event SET group=?, boxed=?, name=?, location=?, time=?, day=?, type=? WHERE id=? LIMIT 1"; if($stmt = $db -> prepare($query)) { $stmt -> bind_param("iisssssi", $group, $boxed, $name, $location, $time, $day, $etype, $id); ...

Rails - execute multiple queries in a single connection

How do I issue multiple SQL queries in a single database connection in Rails? My problem is, I have multiple records(about 200 or more records) to be checked with the database table's existing records(I am checking composite primary key values) I could use ActiveRecord's exists? method in a single transaction block. But I don't know whe...

Could you help me write a proper query in rails for accessing the following information?

@workname = [] @recos = [] @bas = [] if current_user.recommendations.size != 0 current_user.recommendations.each do |r| if r.work_type == 'J' @job = Job.find_by_id(r.work_id) @workname.push "#{@job.title} at #{@job.company.name}" else @qualification = Qual...

MYSQL - Selecting a specific date range to get "current" popular screensavers.

Let's say I have a screensaver website. I want to display the CURRENT top 100 screensavers on the front page of the website. What I mean is, "RECENT" top 100 screensavers. What would be an example query to do this? My current one is: SELECT * FROM tbl_screensavers WHERE WEEK(tbl_screensavers.DateAdded) = WEEK('".date("Y-m-d H:i:s",str...

How do I print all the queries in Magento?

Hi, is it possible to display all the query strings in Magento? I really like to see what queries are executed. Thanks ...