Say I have four tables:
------------- features --------------
id: int
name: varchar
-------------------------------------
-------- feature_categories ---------
feature_id: int
category_id: int
-------------------------------------
----------- categories --------------
id: int
name: varchar
-------------------------------------...
Problem
I'm joining two tables on postcode. I only have the data for the first half. The problem is where I have CM16 6BY in my user table and it matches CM1 and CM16 in my postcode table. Obviously I only want it to match with CM16 but I cannot write a query to do so. I'm sure I am doing something stupid but I am stuck. Can anyone help...
How do you select all the columns from one table and just some columns from another table using JOIN? In MySQL.
Thanks!
...
I would like to delete all the tables from database, but not deleting the database itself. Is it possible ? I'm just looking for shorter way than removing the database and create it again. Thanks !
...
I have a table with the following columns:
id - INT UNSIGNED AUTO_INCREMENT
name - VARCHAR(20)
group - VARCHAR(20)
I know that I can add a row like this:
INSERT INTO table_name (name, group) VALUES ('my name', 'my group')
I wonder if there is a way to add a row without specifying the column names, like when there is no AUTO_INCREM...
Hi
I've got records that indicate when a job starts and when it ends. The End time is not recorded until the job ends, but the start time exists from the time the job starts. What I want is to know how many jobs were running in a given time period.
declare @data table (
JobId INT IDENTITY(1,1),
StartedAt DATETIME NOT NULL,
...
Hi
I want to write a query to get the names of tables of a specific database, but I don't know how can write it.
I want to execute this query for MySql.
...
How do I order records in a PHP query to MySQL by a field that contains TIME() timestamps in descending order?
...
hi,
is there a way to convert from unix timestamp to GMT in mysql while running the query itself??
My query is as follows:
SELECT
r.name
, r.network
, r.namestring
, i.name
, i.description
, r.rid
, i.id
, d.unixtime // this is the unix time i am asking to print
, d.ifInOctets
FROM range AS r
INNER JO...
My connection string for MySQL is:
"Server=localhost;User ID=root;Password=123;pooling=yes;charset=utf8;DataBase=.;"
My questions are :
What query should I write to get database names that exist?
What query should I write to get server version?
I have error because of my connection string ends with DataBase=.
What should I write in...
Hi,
I'm doing some refactoring work on PHP/MySQL code and stumbled across an interesting problem, and as of right now, I can't find a proper solution for it.
I have this table:
CREATE TABLE example
(
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
userID INT UNSIGNED NOT NULL,
timestamp INT UNSIGNED NOT N...
Hi,
I need to intersect two tables based
on a column,in both tables.
Here's my code snippet :
SELECT b.VisitID, b.CarrierName, b.PhoneNum, b.PatientName, b.SubscriberID, b.SubscriberName,
b.ChartNum, b.DoB, b.SubscriberEmp, b.ServiceDate, b.ProviderName, b.CPTCode, b.AgingDate,
b.BalanceAmt, f.FollowUpNote, f...
I'm trying to figure out how to get the top users in each category with a mysql query:
My Users Table looks like this:
user_id,category_id ... and some other stuff
My Votes Table looks like this (each row is one positive vote):
reciever_id ... and some other stuff
I was thinking that I need to first determine the unique votes by user_...
hi,
i want to know what are the various ways to ESCAPE single quotes(') in SQL LIKE command .
one way is to put two single quotes whenever you have to escape a single quote.
Can you people suggest something??
Thanks.
Database -- SQL2005, oracle 10g
...
Hi,
I want to be able to search a field in the database and see if the "changed from" and "to" values are different(the values are stored within a string in a single field).
Here is an example of what the string in the field looks like
Instance Person(34) modified by 1.
Field phone_number changed from "123" to "123".
Current field va...
A quick question. I have a simple table with this structure:
USERS_TABLE = {id}, name, number_field_1, number_field_2, number_field_3, number_field_4, number_field_5
Sorting is a major feature, one field at a time at the moment. Table can have up to 50 million records. Most selects are done using the "id" field, which is the primary k...
How can we find percentile, skewness and kurtosis in MySQL?
Is there any formula?
I want to find the above three for a large number of data records.
Thank you,
J
...
Hello
I am wondering how you would display 2 different kinds of data with one query if its possible in the most efficient way. I want to display a list of featured records and then I want to display a list of none featured records in order.
Here is how i currently have it,
<?php
mysql_connect("localhost","root","") or die(mysql_error(...
I have a listings database. I also have a listings_attributes database that looks like this:
id | listing_id | attribute_id
Basically the listings_attributes table stores the attributes that are assigned to a certain listing.
I am wanting to filter listings depending on what attributes they have.
An example would be I want to find a...
I have a couple of textarea fields, which get saved into the database as text. If the textarea input has a select, selected or selecting in it, the query fails. I've never encountered this before. Am I doing something wrong?
Here's the update query code as an example:
$Query = "UPDATE project SET status = '".mysql_real_escape_string($_...