I am having some trouble with the following queries originally done for some Access forms:
SELECT qry1.TCKYEAR AS Yr, COUNT(qry1.SID) AS STUDID, qry1.SID AS MID, table_tckt.tckt_tick_no
FROM table_tckt INNER JOIN qry1 ON table_tckt.tckt_SID = qry1.SID
GROUP BY qry1.TCKYEAR, qry1.SID, table_tckt.tckt_tick_no
HAVING (((table_tckt.tick_n...
I'm currently working on a small MFC program that outputs data from a mysql database.
I can get output when i'm using an sql statement that does not contain any variable eg.
select album from Artists;
but when i try to use a variable the program compiles but i get no output eg.
mysql_perform_query(conn,select album from Artists w...
I am trying to format a date:
FORMAT(table.TCKT.TCKT_ISS_DATE, 'YYYY') AS TICKETYEAR
but I am getting the following error:
ORA-00904: "FORMAT": invalid identifier
Right now the date show the complete timestamp. Any suggestions on how to fix this problem, or any other way to format the date to just show the four digit year?
...
I'm trying to figure the best way to query a date range from rails...I looked around on Google but am unsure about how to use this syntax.
I have a Model that has various events and I like to add to my find condition a caveat that should only show events where the field :st_date is today or later, in effect only show me data that is cur...
How would I list a page of the top commented pages on the site with PHP and mysql?
The database is set up sort of like this:
page_id | username | comment | date_submitted
--------+----------+---------+---------------
1 | bob | hello | current date
1 | joe | byebye | current date
4 | joe | stuff | d...
Magento database name convention is not trivial. How to get these fields below for last 7 days?
Last Name
First Name
Address
City
State
Zip
Phone
Email
Amount
Order #
Item #
...
My table structure is as follows:
Person 1-M PesonAddress
Person 1-M PesonPhone
Person 1-M PesonEmail
Person 1-M Contract
Contract M-M Program
Contract M-1 Organization
At the end of this query I need a populated object graph where each person has their:
PesonAddress's
PesonPhone's
PesonEmail's
PesonPhone's
Contract's - and this h...
I would like to set a default value to a variable
SELECT ID, VALUE
FROM TABLE
Now I would like that value to have a default value of 0 for every ID. What can I do?
...
How to rewrite a url like:
http://domain.com/class/method/parameter1/parameter2/.../parameterN
to
http://domain.com/index.php?c=class&m=method&p1=parameter1&...&pN=parameterN
The main idea is to create the possibility of using unlimited number of query parameters.
Thanks.
...
I have a table that stores a value that will be added to over time. When I want to add to the value I would like to do so in a single query rather than -
Get oldValue from database
newValue = oldValue + X
update row with newValue
$query1 = "SELECT value FROM table WHERE id = thisID";
$result1 = mysql_query($query1);
while($row=mysql_f...
Hi,
I’m having some difficulties with two queries. I can get some of the information but my problem lies in the some special conditions I just can’t seem to get right in the SQL statement.
The first query is in natural language defined:
I’m going to find all the candidates who has acquired two qualifications but during the same time p...
Hello,
How can I query data from a table available on a list of strings?
I only want to get the data from the list of strings.
Example:
Table
ID Name
1 Big
2 Small
3 Extra
4 Orange
5 Drink
List of Strings:
Big
Small
Extra
Thanks!
...
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| pid | varchar(99) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
1 row in set (0.00 sec)
+-------+---------------+------+-----+...
I'm trying to select all fields in two separate tables as long as they're sharing a common ID.
//mysql query
$result = mysql_query("SELECT * FROM project, links
WHERE project.id = links.id and project.id = $clientID")
//displaying the link
if ($row['url'] != null){
echo "<div class='clientsection' id='links'>Links</div>";
ec...
I'm currently developing a program that will generate reports based upon lead data. My issue is that I'm running 3 queries for something that I would like to only have to run one query for. For instance, I want to gather data for leads generated in the past day
submission_date > (NOW() - INTERVAL 1 DAY)
and I would like to find out how...
Hello,
I use : Subsonic 3, SQL Server 2008, Json.Net
Here is my problem :
I have a house table with id,lot number, address, location, ownerid and an owner table with id,name, description.
I'd like to get only the owner name and address of house where location is "San Francisco".
How can I do this with Subsonic?
My problem is I can ...
Hello Guys,
Im trying to query a sort of from - to date.
e.g. 20-01-2010 to 20-02-2010. this should include the mentioned dates.
i've tried the following queries but none works.
select *
from [tableName]
where date >= '20-01-2010'
AND date <= '20-02-2010'
but the date where date is equal to 20-02-2010 does not show. i don'...
Hi Folks,
I have a tables in my database called "points" and "category". A user will input info into both a location input and a keyword input text box.
Then I want to find points in my table where the keyword matches either the "title" field in the points table, or the "category" but are within a certain distance from the user's loca...
Hello all , Can any one please give me the query to get the child name and his grand fathers name For eg - if i have a table Relationships in the i have childid and fatherid columns so how will i get the grandfather,
i can easily get the father name by using a join but for grandfather i need to do joins 2 times so can any one help me wi...
I have tried this which did not work.
select top 5 * from [Table_Name]
...