I am trying to write a query to select all records from users table where User_DateCreated (datetime field) is = 3 months from today.
Any ideas? Thanks!
Hi,
These are the input table and required output table.
Input table
ID Name
-------------
1 aaa
1 ababaa
2 bbbbbb
2 bcbcbccbc
2 bcdbcdbbbbb
3 ccccc
Output table
ID Name Ord
-----------------------------
1 aaa first
1 ababaa rest
2 bbbbbb first
2 bcbcbccbc rest
2 bcdbcdbbbbb rest
3 ccccc first
First and Rest is based on the occurrence of an ID field.
Is there a way to write a SQL query to achieve this ?
P.S. - This question is somewhat similar to what I am looking for.
Hi,
If a website operating on a domain other than my own supports get requests, like:
http://api.someothersite.com/v1/farms
There's no way for me to access it using JSON-P right, they would have to have support for it as a query parameter? Something like:
http://api.someothersite.com/v1/farms?callback=fantastic
I mean, there's no way for me to use it without them explicitly supporting it, right?
Thanks
Let's say I have the following array (which is the returned value of a database query):
Array ( [0] => PHP [1] => Webdesign [2] => Wordpress [3] => Drupal [4])
And the following string:
Working With Wordpress Shortcodes
How can I compare the array with the string to see if the string contains any word stored in the array? (hopefully that made sense to you :d )
When he finds a match (eg: Wordpress) it should create a hashtag like so:
Working With #Wordpress Shortcodes
Hi,
I am using group by ID WITH ROLLUP in my mysql query. The thing is I want to store these totals in a variable in php. Is there any way to do that?
Thanks.
I am trying to output a long XML result from SMSS.
When I right click on the results and 'save results as...', I can only get a 2mb file?
I have changed the settings in SMSS via Tools - Options - Query Results - SQL Server - Results to Grid, for XML data to be unlimited.
Forever, it still seems to be truncating my XML results?
So, how can I bypass this problem and output my XML result to a file?
Thanks
I have a table which has a bunch of columns but the two relevant ones are:
Due_Amount MONEY
Bounced_Due_Amount MONEY
I have a SQL query like the following
SELECT * FROM table WHERE (Due_Amount 0 OR Bounced_Due_Amount 0)
Would the best index to put on this table for SQL Server 2008 be an index which includes both columns in the index, or should I put an separate index on each column?
I'm trying to write a little SQL Helper. I have a query like this stored in a string:
DECLARE @V1 INT
--ignore
DECLARE @V11 INT
DECLARE @V12 INT
--endignore
DECLARE @V2 INT
--ignore
SELECT * FROM SampleTable
INNER JOIN AnotherSampleTable
......
--endignore
SELECT * From Employee ORDER BY LastName
My helper method should cut everything what's between
--ignore
and
--endignore
The result string should look like:
DECLARE @V1 INT
DECLARE @V2 INT
SELECT * From Employee ORDER BY LastName
How can achieve my result with RegEx?
hello.
I am wondering if there is local version control/snapshots for emacs independent of VC?
let me clarify:
every time I save buffer, I would like to be able to keep track of changes of each save in session. I know I can do something similar with backup files, but they are not automated like VC and a somewhat cumbersome.
I have searched Google, but did not find the solution.
Perhaps my query string was not good.
Thanks
I would like to display the contents of a DataTable, divided into several groups depending on the value of one of the columns. So, if I have a DataTable (from SQL query) with:
GroupID Name Description
1 foo bar
1 one two
2 some thing
I would like to place all records containing GroupID 1 in one div, all records with GroupID 2 in another div, and so on. How can I do this?
I'm writing in ASP.NET 4.0, with C# codebehind.
Hi all,
it may be wrong place to ask this question, but i hope u all programmer must have the interesting naming convention of variables. i have seen many places that some variable names are very good n effective like
common variable names
$link
$db
$connect
$query
$stmt
$sql
$qry
$output
$result
$list
so please suggest me some good names for variable , bcoz all time i have to write
$x, $y etc.. if i want to save something instantly on page...that are even not relevant, so please suggest me good variable names
I'm passing query string parameter to .aspx page with 'Ñ' character in value.
But Request.QueryString returns some other box '[]' character in return.
I think this request encoding issue. and I do not want to use that HttpUtility.UrlDecode and HttpUtility.UrlEncode methods.
Does anyone know how to solve this?
Hi,
I am trying to make a dynamic form which retrives data. How can I use javascript to load a value from a mysql database?
I understand that it must use php in some way, and I know how to query the database and assign the value to a php variable, but I have no idea what to do after that...any advice?
the goal is to have someone enter their orderid say, then the datbase auto pulls down and enters their last invoice in the field below it after they click GO...
My Scenario is...
I want to find out whether the table has an identity column or not.Table is unknown to me.I have not done the structure of the table.using Query?
Im using Sql Compact.
Hi guys,
I am here to write a small database application that will be running in desktop (offline mode).
I am using MSAccess 2007 as my database file and trying to write code in vb.net.
I used to write the code vb6 an usually had global variables for storing database connection and executing every query from that.
I am trying to upgrade myself from vb6 to vb.net.
do i need to read some more simple starter books also?
I am implementing Paging in my application. For this i run a query and get a resultset.
Now i want to get total no of records in this resultset for my paging calculation. How can i get ? i dont want to execute a extra sql which gives me total rows
When I do an XMLHttpRequest, I always get redirected automatically to the URL (presumably by the headers of the response). For example, if I query "http://www.stackoverflow.com" I will be redirected to "http://stackoverflow.com".
How can I get that final URL? (http://stackoverflow.com/ in the example)
I checked in the response headers but I cannot seem to find it. (I just used the GET/POST method not HEAD).
I have an app that reads and writes data from sqlite3. I tested it on the simulator it looks like everything is OK. But if the ad-hoc version does a 'delete' or 'insert' query in the sqlite3 file on iPhone, it crashes.
Is it possible to debug ad hoc versions of iPhone apps with XCode?
I have a table with products, their amount and their price. I need to select all entries where the average price per article is between a range.
My query so far:
SELECT productid,AVG(SUM(price)/SUM(amount)) AS avg FROM stock WHERE avg=$from AND avg<=$to GROUP BY productid
If do this, it tells me avg doesnt exist.
Also i obviously need to group by because the sum and average need to be per wine
I have a fairly complicated mathematical function that I've been advised should be implemented as a User Defined Function in SQL Server so that it can be used efficiently from within a SQL query.
The problem is that it must be very efficient as it may be executed thousands of times per second, and I subsequently heard that UDFs are very inefficient.
Someone suggested that I could implement the function in C# instead, and that this would be much more efficient.
What should I do?
I would like to create a stored procedure that takes in a string of comma separated values like this "1,2,3,4", and break it apart and use those numbers to run a query on a different table.
so in the same stored procedure it would do something like
select somefield from sometable where somefield = 1
select somefield from sometable where somefield = 2
select somefield from sometable where somefield = 3
select somefield from sometable where somefield = 4
Thanks!
I have the following query
SELECT *
FROM attend
RIGHT OUTER JOIN noattend ON attend.date = noattend.date2
WHERE attend.date
BETWEEN '2010-02-01'
AND '2010-04-01'
AND attend.customerid =1
ORDER BY date DESC
LIMIT 0 , 30
Attend is the table with customerid
noattend is the table with a row for each date (date2) I followed the advice in other questions to right outer join it to create values where there is no record in attend but it still isn't filling in the empties
any help much appreciated