473,386 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Tricky SQL query!

I am writing an application which produces labels for an overnight
Courier Company. In the mySQL database I have a field called 'NOP'
which records the 'number of pieces' for each consignment.

I have to produce one lable for each piece that is being shipped. The
label production module currently accepts an SQL query and prints one
label per returned row.

Does anyone know if it is possible to write a select query which would
produce a row based on the 'NOP' field? Imagine the following records

NOP Destination
--- -----------
1 London
1 Manchester
2 Glasgow

In this example, the Glasgow row would be repeated so that two labels
would be printed.

Any help appreciated.

Malc.
Jul 19 '05 #1
2 3395
On 2 Jan 2004 15:40:25 -0800, in mailing.database.mysql
mf*****@btinternet.com (Malc) wrote:
| I am writing an application which produces labels for an overnight
| Courier Company. In the mySQL database I have a field called 'NOP'
| which records the 'number of pieces' for each consignment.
|
| I have to produce one lable for each piece that is being shipped. The
| label production module currently accepts an SQL query and prints one
| label per returned row.
|
| Does anyone know if it is possible to write a select query which would
| produce a row based on the 'NOP' field? Imagine the following records
|
| NOP Destination
| --- -----------
| 1 London
| 1 Manchester
| 2 Glasgow
|
| In this example, the Glasgow row would be repeated so that two labels
| would be printed.
|
| Any help appreciated.
|
| Malc.


You shouldn't be looking at the SQL statements to do this work but the
routine(s) that print the actual label.

Read data from table
while NOT recordset.EOF
for counter = 1 to recordset.NOP_value
'--- print the label
next
get next record
close recordset
---------------------------------------------------------------
jn****@yourpantsbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 19 '05 #2
On 2 Jan 2004 15:40:25 -0800, in mailing.database.mysql
mf*****@btinternet.com (Malc) wrote:
| I am writing an application which produces labels for an overnight
| Courier Company. In the mySQL database I have a field called 'NOP'
| which records the 'number of pieces' for each consignment.
|
| I have to produce one lable for each piece that is being shipped. The
| label production module currently accepts an SQL query and prints one
| label per returned row.
|
| Does anyone know if it is possible to write a select query which would
| produce a row based on the 'NOP' field? Imagine the following records
|
| NOP Destination
| --- -----------
| 1 London
| 1 Manchester
| 2 Glasgow
|
| In this example, the Glasgow row would be repeated so that two labels
| would be printed.
|
| Any help appreciated.
|
| Malc.


You shouldn't be looking at the SQL statements to do this work but the
routine(s) that print the actual label.

Read data from table
while NOT recordset.EOF
for counter = 1 to recordset.NOP_value
'--- print the label
next
get next record
close recordset
---------------------------------------------------------------
jn****@yourpantsbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: dracolytch | last post by:
Good day all, Ok, I have a pretty tricky problem that I need some help with. I pass around search query information a fair amount (specifically WHERE statements). Normally, I just rawurlencode()...
5
by: scott | last post by:
Hello, I'm trying to find the most optimal way to perform a tricky query. I'm hoping this is some sort of standard problem that has been solved before, but I'm not finding anything too useful so...
3
by: Novice | last post by:
Hey all, I've attempted to simplify my question (or at least the XML that is part of my example in my question): I have the following XML: <A> <B><C><D> I want to query the data in this node...
1
by: Pea | last post by:
I'm working with a system usage database. I want to filter out repetitive logins. The query I have retrieves data like this: USER_DATE USER_TIME1 USER_USERID USER_ACCOUNT...
6
by: pointBoarder | last post by:
Thanks in advance to all who read this. I've got 3 tables which were created from a txt file dumped from some old system. Header ID -- autonumber, primary OrderNum -- field I want Line
5
by: ric_deez | last post by:
Hi there, I would like to create a simple search form to allow users to search for a job number based on a number of parameters. I think I understand how to use parameteres associated with Stored...
1
by: MorrganMail | last post by:
Or at least I find it tricky. :-) Assume we have three tables A, B and C. Table A contains a path and the distance for traveling that path: A (PathId, NodeId, Dist (from previous node)) 1, 1,...
15
by: edouard.spooner | last post by:
Hi, I have a tricky SQL query problem that I'm having probs with. I have a table which resembles something like this Date | Price1 | Price2 | Price3 01 Jan 2006 | 100 | 100 | 100 02 Jan...
0
by: hdogg | last post by:
I am using oracle with php. I am trying to accomplish a left outer join. Here are the 3 queries. Query 1, contains all the data on the left the will show up with data on the right. Query 1 =...
7
by: Whizzo | last post by:
Hi folks; Hope the example data below displays properly for you? CustName FireID CustID PolicyNo PolicyVal BuildingVal Claire Sheene 8 88221 125584 12,500 12,500...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.