Hello :D I am using the twitter API to perform a search for a certain author, and storing the results in a database so that I can perfrom an action on each entry. However, there are many duplicate results that have small differences at the beginning of the string or at the end that I do not want to respond to. I have managed to select all the distinct entries based on a substring: `SELECT DISTINCT (SUBSTRING(msg_text FROM 10 FOR 75)) AS res FROM goethe_search;` ...which gives me the dinstinct substrings but not the other fields that corelate to the …

Member Avatar
Member Avatar
+0 forum 1

Hello :) I'm working with a database of postcodes. I have an existsing query that returns the postcodes within a certain radius: `select *, acos(cos(51.496502411798 * (PI()/180)) *cos(-0.13982862499836 * (PI()/180)) *cos(lat * (PI()/180)) *cos(lng * (PI()/180))+cos(51.496502411798 * (PI()/180)) *sin(-0.13982862499836 * (PI()/180)) *cos(lat * (PI()/180)) *sin(lng * (PI()/180))+sin(51.496502411798 * (PI()/180)) *sin(lat * (PI()/180))) * 3959 as Dist from SW having Dist < 1 order by Dist` *Dist 1 is the number of miles for the search radius.* I am making a script that will allow the user to enter a postcode and return a list of postcodes in the given radius. …

Member Avatar
Member Avatar
+0 forum 5

I have two tables, author and quote: author: AID, Name, YOB, YOD. quote: ID, AuthID, Content. I currently get all the authors with one query and as I loop through them, I run a second query to get the count of quotes that have the current AID: $sql = "SELECT AID, Name FROM author order by Name"; if (!$res = $this->conn->query($sql)){ echo $this->conn->error; die(); } else { while($row = $res->fetch_assoc()){ $count_sql = "select count(*) as count from quote where AuthID='".$row['AID']."'"; if (!$count_res = $this->conn->query($count_sql)){ echo $this->conn->error; die(); } else { $count_row = $count_res->fetch_assoc(); $row['count'] = $count_row['count']; } Is it possible …

Member Avatar
Member Avatar
+0 forum 5

The End.